Making field Mandatory on catalog task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 09:05 AM
Hey Experts,
I have RITM workflow which creates 3 catalog tasks, But, I wanted to make one field mandatory on only 1 catalog task and that field should be non mandatory on other 2 catalog tasks.
How can I achieve this?
Thanks,
Rocky,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 10:43 AM
I agree with Ankur. Hopefully you have a specific short description on the task that so you can use that in a client script to make it mandatory on only that particular task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2020 08:18 AM
Hi Rocky,
In addition to above you need to check the RITM sys_id as well so that this client script runs only for your catalog item
sample script below
function onLoad(){
var catalogItemSysId = g_form.getReference('request_item').cat_item;
var shortDescription = g_form.getValue('short_description');
// add your catalog item sys_id here and your specific short desc to compare
if(catalogItemSysId == '<Your Catalog Item SysId>' && shortDescription == 'Specific Value'){
g_form.setMandatory('field_name', true);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 09:11 AM
Is the short description consistent on your tasks?
You could use a catalog client script, set to only execute on tasks and check the value of g_form.getValue('short_description') and if it matches your task, set the variable you want mandatory with g_form.setMandatory();.
It's not perfect, but it should get the job done for a one-off.
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 09:12 AM
We have a client script on sc_task. You can run this onChange or onSubmit if the field/variable should only be mandatory before the task closes, or onLoad otherwise. To narrow it down to only this task on this catalog item, use something like this
if(g_form.getValue('request_item.cat_item') == '4f87518fdbec0f004a29df6b5e96195c'){ // sys_id of catalog item
if(g_form.getValue('short_description') == 'Validate Build & Capacity'){ //task short description
g_form.setMandatory('v_estimated_completion_date', true);
}
}