Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to make the fields readonly afater submit the request form on the portal.

dhineshkumar
Tera Guru

Hi Experts 

 

I want to make the fields (First name and second name) readonly, if assignment group is "Network" after I submit the request on the portal page. 

dhineshkumar_0-1676968211669.png

Thank you.

1 ACCEPTED SOLUTION

Jyoti Jadhav9
Tera Guru

Hi @dhineshkumar,

 

If Assignment group = Network then First name and last name variables should be readonly on RITM ticket.

 

For above functionality, you can create UI policy on Requested Item table, Add the condition " Item is User Facade" and Assignment group is network.

Go to Script Tab and make the Run script checkbox true.

Add the below code in Execute if True script field:

g_form.setReadOnly("variables.first_name",true);

g_form.setReadOnly("variables.last_name",true);

 

Add the below code in Execute if False script field:

g_form.setReadOnly("variables.first_name",false);

g_form.setReadOnly("variables.last_name",false);

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

 

Thanks & Regards

Jyoti Jadhav

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi @dhineshkumar ,

 

If you want to make fields readonly on requested item or catalog task than create a UI policy and select the checkbox "Applies on Requested Items" OR "Applies on Catalog Task" and deselect the other one "Applies on Catalog Item view".

 

AnandMahajan_0-1676968932208.png

 

Anand

ServiceNow Developer

Jyoti Jadhav9
Tera Guru

Hi @dhineshkumar,

 

If Assignment group = Network then First name and last name variables should be readonly on RITM ticket.

 

For above functionality, you can create UI policy on Requested Item table, Add the condition " Item is User Facade" and Assignment group is network.

Go to Script Tab and make the Run script checkbox true.

Add the below code in Execute if True script field:

g_form.setReadOnly("variables.first_name",true);

g_form.setReadOnly("variables.last_name",true);

 

Add the below code in Execute if False script field:

g_form.setReadOnly("variables.first_name",false);

g_form.setReadOnly("variables.last_name",false);

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

 

Thanks & Regards

Jyoti Jadhav