Okay here is my scenario. I need to disable some fields on a form depending on which user logs onto workspace to open the same form.
1. User1 logs onto workspace and opens leave request form, fields at the top of the form are enabled for the user to fill out, bottom fields which are for leave request administrator to fill out are disabled but visible.
2. User1 fills out top portion of leave request form and completes form. Workflow sends form to leave request administrators "To do" list in Workspace.
3. Administrator opens up submitted form in Workspace and sees User1's filled out data on the form and the bottom fields are now enabled for administrator to approve or dissaprove. Bottom fields only include two check boxes, two text fields and one date field.
Now how is this done? I am sure their maybe scripting involved? if so what is it and at what events in the form? Is this whole process done in the form or through Admin UI or Workebench as well? Please help!!!!!!!!!
If your form is simple; for example two sections that needed to be enabled or disabled based on the User Task in which the form is being viewed, there might be a rather blunt way you can do this.
You could make two copies of the same form with the appropriate changes to the fields and then modify the Form URL repository location in your xfaform variable using a Set Value before the User Task. If other than field status, both forms are the same then the data will still pass from one user's form to the next.
I'm not saying this is a best practice ..and others on the forum might be appalled at such a hack 🙂 But it's easy for simple scenarios. Otherwise you need to learn how to author your form with script triggered from a hidden field value that gets set on the server when you render the form.
You can use the same form and enable/disable some fields according to the user's role with only little scripting. Review the steps the below:
1-First place a hidden field ("user_role") in your form
2-Insert a script object into your form onder "Variables" in object hierarchy and write a script for enabling/disabling the fields (regarding the value of "user_role")
3-On the initialize and change events of the "user_role" call your script object
4-On your process design, put a SetValue service before User tasks. In the asssignment you should set the desired user_role to the form, so that the script is triggered in your form and the fields are enabled/desiabled