how to make some fields read only and some fields editable based on assignment group on SC Task

Sateesh11
Tera Contributor

We have created one catalog item named " Off-boarding" in our dev environment, whenever a request is ordered 7 catalog tasks are created automatically and assigned to different assignment groups as configured in the workflow.
Our requirement is variables should be editable to assigned groups only and read-only to other groups.

For example, assume the scenario below:
------------
The Lab Operations-Off Boarding group members can only edit the 'ELN' variable and the remaining variables should be read only for this group.
ComplianceWire-Off Boarding group members can only edit the Compliance Wire variable value and the remaining variables should be read-only for this.

6 REPLIES 6

Mounika Mulkall
Tera Contributor

Hi Sateesh,
If possible could you please provide exact script here because i'm having same scenario.
Thank you... 

Hi Mounika,

Created one display business rule and it should be run only for specific item (used filter condition)

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    g_scratchpad.isGroup = current.getDisplayValue('assignment_group');
    gs.log("The assignment group is: " + g_scratchpad.isGroup);
      g_scratchpad.member = gs.getUser().isMemberOf(g_scratchpad.isGroup);
})(current, previous);
2. created ui policy and selected catalog tasks check box and written code under script part
read only flase or true based on your requirement
function onCondition() {
   
      if(g_scratchpad.member == true && g_scratchpad.isGroup == "Facilities"){
       
        g_form.setReadOnly('compliancewire_1',true);
 
g_form.setReadOnly('parking_badge_s',false);
g_form.setMandatory('parking_badge_s',true);
       
    }
if(g_scratchpad.member == false && g_scratchpad.isGroup == "Facilities"){
     g_form.setVariablesReadOnly(true);
}
}
 
Thanks,
Sateesh