catalog task

servicenow14710
Tera Expert

Hello developers, i have a requirement to make variable readonly on catalog task view once the task is closed complete,can i do this via workflow, if not  any suggestions is appreciated. Thanks!

10 REPLIES 10

@SarthakShri21 :hi , to make variable readonly on catalog task view once the task is closed complete,can i do this via workflow

Best to use UI policy.  @servicenow14710 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Sumanth16
Kilo Patron

Hi @servicenow14710 ,

 

If the exception is having a variable editable on the task, you could have an on Load Client Script that makes all variables read-only (as above) then create UI Policy on Catalog Task that controls your exception by making them read-only = false. UI Policy runs after Client Script.

If the exception is the variable being read-only, then control purely through UI Policy.

The best practice would be to minimize code and prefer codeless or low-code solutions where possible. Sometimes it makes sense to use code to minimize configuration overhead.

 

 

You can write a client script on Task table onChange on field name State.



var catalogitem = g_form.getValue('u_item');

 

if(catalogitem=='Your catalog Item')

 

if(newValue==closedvalue && catalogitem=='Your Catalog Item')

 

{

 

g_form.seReadOnly('variables.Yourvariablename',true);

 

}

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

Hi @Sumanth16 : I have to make variable readonly when catalog task is closed complete, else it should be editable. Thanks!

Hi @servicenow14710 

 

UI policy is best way, i already answered , give a try buddy.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************