catalog task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 03:00 AM - edited 03-13-2024 11:51 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:53 AM
@SarthakShri21 :hi , to make variable readonly on catalog task view once the task is closed complete,can i do this via workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:55 AM
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 12:12 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 12:28 PM
Hi @Sumanth16 : I have to make variable readonly when catalog task is closed complete, else it should be editable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 12:30 PM
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]
****************************************************************************************************************