- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 12:31 PM
Hello Im looking for a way to have a vairable field be Mandatory if the Task is set to closed complete.
Basically not allow users to close the SCTASK without filling out the variable. something like this.
Any help is appreciated. Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 12:47 PM
I have this requirement often. An onSubmit Catalog Client Script that Applies on Catalog Tasks is the way to go. You only need one script per catalog item. You can, and probably will have many iterations of this requirement - this variable is mandatory on this task and that one, and this one is mandatory if the task is closed complete, incomplete, or skipped,... - all just modifications to the if statements below
function onSubmit() {
if(g_form.getValue('state') == 3){//Closed Complete
if(g_form.getValue('short_description') == 'Request a Knowledge Article'){//to make this variable mandatory when only this task closes
g_form.setMandatory('v_testing_field', true);
if(g_form.getValue('v_testing_field') == ''){
alert('Testing field is required');
return false;
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2022 09:13 AM
What did you come up with?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 02:10 PM
Here is a link to his blog post: https://www.servicenow.com/community/now-platform-blog/what-is-the-best-way-to-make-catalog-task-var...