how to lock the variable field on sctask ?

chercm
Mega Sage

I have created a sctask form but the variable field seems to be changeable 

 

how to lock it ?

 

chercm_0-1703258469489.png

chercm_1-1703258492772.png

 

 

1 ACCEPTED SOLUTION

SunilKumar_P
Giga Sage

Hi @chercm, You can try the below catalog client script that applies to requested items and catalog tasks to make the complete variable editor ReadOnly.

 

function onLoad() {
   g_form.setVariablesReadOnly(true);
}
 
If you want to make the particular variable ReadOnly then you can create a catalog UI policy that applies only to RITMs and SCTASKs.
 
Regards,
Sunil
 

View solution in original post

5 REPLIES 5

ahefaz1
Mega Sage

@chercm ,

 

Try below:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0718582

you need to create a UI policy, that applies to the requested item record and make the fields read only using the UI policy actions.

 

ahefaz1_0-1703261013918.png

Please mark helpful, if this helped

 

Thanks,

SunilKumar_P
Giga Sage

Hi @chercm, You can try the below catalog client script that applies to requested items and catalog tasks to make the complete variable editor ReadOnly.

 

function onLoad() {
   g_form.setVariablesReadOnly(true);
}
 
If you want to make the particular variable ReadOnly then you can create a catalog UI policy that applies only to RITMs and SCTASKs.
 
Regards,
Sunil
 

@SunilKumar_P  the script is already there but it is not active . dumb me . 

Prateek kumar
Giga Sage

If you have a UI policy set the Applies to target record, applies to Requested items and Applies to catalog tasks to true