client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 05:50 AM - edited 10-18-2023 06:09 AM
Hi ,
I have
3 different assigned groups(X,Y,Z) on task form
1 field as sub status on task form
(if assigned group to X) then members of Y and Z should not be able to edit the substatus field on the task form
(if assigned group to Y) then members of X and Z should not be able to edit the substatus field on the task form
(if assigned group to Z) then members of X and Y should not be able to edit the substatus field on the task form
I want the above in a single if condition, please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 06:11 AM
Hi @Shreshta_happy ,
The logic for this would be if the logged in User is member of the assigned group then g_form.setReadOnly('substatus',false);
else
g_form.setReadOnly('substatus',true);
for validation u need to write a client script where u need to pass assigned group as parameter to script include using Glide Ajax.
Check the logic in the script include where logged in user is member or not of the assigned group.
Return true or false from script include & based upon answer received make the substatus field read only.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 06:25 AM
(function executeRule(current, previous /*null when async*/ ) {
g_scratchpad.grpx = (gs.getUser().isMemberOf("sys_id_of_x_grp"));
g_scratchpad.grpy = (gs.getUser().isMemberOf("sys_id_of_y_grp"));
g_scratchpad.grpz = (gs.getUser().isMemberOf("sys_id_of_z_grp"));
})(current, previous);
OnLoad Client Script :-
function onLoad(){
var grp = g_form.getValue('assignment_group');
if(grp=='sys_id_of_x_group'){
if(g_scratchpad.grpx != true){
g_form.setReadOnly('sub_status', true);
}
}
if(grp=='sys_id_of_y_group'){
if(g_scratchpad.grpy != true){
g_form.setReadOnly('sub_status', true);
}
}
if(grp=='sys_id_of_z_group'){
if(g_scratchpad.grpz != true){
g_form.setReadOnly('sub_status', true);
}
}
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 06:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 03:35 AM
You can achieve this with a client script. Use the logic provided by Danish Bhairag2 for setting read-only status based on assigned groups. Samaksh Wani's script illustrates the implementation.