how to make fields read-only based on group

max_danielewicz
Giga Expert

Hi There,

I would like to make some fields read-only when a change reached the authorized state. This should apply to all users except those in the change managers.

i created a ui policy which applies when status is one of (authorized, scheduled, implemented, review and closed).

Unfortunately, the condition is not working, however, if i remove the condition will make the fields read-only for everyone.

additionally i added a script:

execute if true:

function onCondition() {

if (g_user.hasRoles('change_manager') == false) {

  g_form.setReadonly('short_description',true);

  g_form.setReadonly('justification',true);

  g_form.setReadonly('implementation_plan',true);

  g_form.setReadonly('risk_impact_analysis',true);

  g_form.setReadonly('backout_plan',true);

  g_form.setReadonly('test_plan',true);

  g_form.setReadonly('start_date',true);

  g_form.setReadonly('end_date',true);

}

}

i would prefer to change conditional for membership group instead.

any help will be appreciated.

max

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

Hi,



This can be done using the UI Policy as shown below:



find_real_file.png



In the Run Script section of UI Policy write the below script:



Script:



function onCondition() {


if(!g_user.hasRole('change_manager'))


  {


  g_form.setReadOnly('short_description',true);


  g_form.setReadOnly('description',true);


  }


}



find_real_file.png



This is working fine for me in my personal instance. Please test the same from your end too.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

5 REPLIES 5

shloke04
Kilo Patron

Hi,



This can be done using the UI Policy as shown below:



find_real_file.png



In the Run Script section of UI Policy write the below script:



Script:



function onCondition() {


if(!g_user.hasRole('change_manager'))


  {


  g_form.setReadOnly('short_description',true);


  g_form.setReadOnly('description',true);


  }


}



find_real_file.png



This is working fine for me in my personal instance. Please test the same from your end too.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke