How to make certain fields read only after submitting (save) the form.

Sourabh26
Giga Guru

I have to make User, Description, Return type, From & To fields read only after save the form.

find_real_file.png

8 REPLIES 8

Hi,

 

Please refer the links below for more understanding of UI Policy and client Scripts:

 

https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_scripting_london_client...

Also please go through the below community article by Deepak Ingale which explains very clearly on when to use UI Policy or Client Script:

 

https://community.servicenow.com/community?id=community_blog&sys_id=512d26e5dbd0dbc01dcaf3231f9619ce

 

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

 

Regards,

Shloke

 

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

Regards,
Shloke

shloke04
Kilo Patron

Hi,

 

Before going ahead with the script, could you please elaborate on what conditions you want to make field as Read Only, is it after every save are you planning to check the Read only behavior i.e. for example when the new record is submitted and post that you want to make Read only ?

 

Regards,

Shloke

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

Regards,
Shloke

Andrew_TND
Mega Sage
Mega Sage

Before you start throwing code at it I would probably say do a UI Policy so when its in new state its editable but when its anything else it becomes read only.

However, if you want it read only after saving... I would probably say Amans Client script would do the trick.

Sangeeta Choudh
Giga Expert

hi Sourabh,

 

You can also use UI policies to achieve this. 

Write in the condition User, Description, Return type, From & To fields are not empty.

Give different UI policy action to all these fields and choose action as visible true.

 

Thanks,

Sangeeta Choudhary