Agent workspace make all fields read only if state is work in progress

BuriB
Tera Expert

Hi All, 

 

We would like to make all fields read only on the agent workspace. I manage it with a ui policy, but it does not work for the related list. 

 

What I did: 

BuriB_0-1738305057216.png

 

BuriB_2-1738305091636.png

 

But on the related list, all fields are editable and not read only: 

BuriB_3-1738305214974.png

 

BuriB_4-1738305248329.png

 

Can you help? 

 

Thank you

1 ACCEPTED SOLUTION

@BuriB - In this section you write code if you want to run if condition given is not matching. Also, for existing Ui Policy written you don't need to do anything you will need to write new one for your related list table. Before that see how related list table is associated with parent record check the mapping done then try to put similar condition in UI Policy and in script true part put similar code you created for your first ui policy.

Also, I recommend you watching this video https://youtu.be/6mPD-D2zydc?si=aAhkYnWtxGuiCKS-

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

View solution in original post

This video is part 8 of ServiceNow Developer Training. In this video you will learn about UI Policy used in ServiceNow. You will learn: - What is UI Policy? - How to create UI and do scripting in UI Policy - Baseline UI Policy Watch complete playlist of ServiceNow Developer Training - ...
6 REPLIES 6

BuriB
Tera Expert

 I mean when state is not work in progress

 

Viraj Hudlikar
Giga Sage

Hello @BuriB 

 

Your statement has answer, you have written Ui Policy over main table right so it will act only for the main table record when state is not WIP. Now to make all related list record mapped with parent record as read-only you will write multiple Ui Policy by building relation stating as if related record is mapped with parent record and state is not WIP then make all field readonly as per your script.

OR
Another way is create a write table ACL on related list table by giving condition that it has been linked with parent record and if state is not WIP then return answer = false in script which will make all fields non-editable.

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.


  

Hi @Viraj Hudlikar , 

 

Thank you, but I am not expert in it. How should the script in Ui Policy looks like? Where and what to do? 

 

Kind regards

@BuriB - The screenshot you attached is Ui Policy and for scripts in Ui Policy you can see in screenshot where it showcase script tab and run scripts checkbox when selected it will showcase two fields as execute if true/false, now this true section work when condition given to run matches and false section will run when condition is not matching.

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.