Order guide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Order guide :- Onboarding
There are multiple catalog items configured through rule base in that only for some items Validation task will generate
Only for SCTASK short description that starts with "Validation Task..."
Prohibit Close Skipped of validation task for Onboarding Request catalog item. Pop up message: “Only Close Incomplete or Close Complete Allowed”
Please help me how to achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
58m ago
If I understand your question correctly, you want to prevent someone from closing a particular task as Close Skipped. If that's the case, you will need to create an onSubmit catalog client script to check that value and show a message and return false if they select Close Skipped.
The trick is determining this is the right task. You can use a field like Short Description, but that is something the user can change. In our environment, I created a field called Task Type (u_task_type) that is something the users don't see but I can set it in the Flow when I create the task and then use that to key off of. Here is a sample client script I use to require a field to be filled out before a specific task is closed. You could easily modify this for your scenario.
function onSubmit() {
var taskToCheck = 'yourtaskname';
var fieldToCheck = 'yourfieldname';
var retval = true;
var gr = new GlideRecord('sc_task');
gr.addQuery('sys_id', g_form.getUniqueValue());
gr.query();
if (g_form.getValue('state') >= 3) { //Closing task
if (gr.next()) {
if (gr.getValue('u_task_type') == taskToCheck) { //This is the right task
var checkVal = g_form.getValue(fieldToCheck);
if (checkVal == '' || checkVal == null) {
g_form.showFieldMsg(fieldToCheck, "This field cannot be blank when closing the task.", "error");
retval = false;
}
}
return retval;
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago
Hi @JenniferRah
I think 'Glide Record' will not work in client script right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
36m ago
It works. We aren't using this on a Portal. It wouldn't work on a Portal, but we don't work tasks that way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
24m ago
Hi @Reddy39,
Here are the precise steps to implement the business rule in ServiceNow to prohibit closing a validation task in the "Closed Skipped" state:
Create a Business Rule
Table: Catalog Task [sc_task]
Name: Prohibit Close Skipped
When to Run:
When: before
Insert: Yes
Update: Yes
Order: 100
Active: Yes
Advanced: Yes
Set Filter Conditions
In the Filter Conditions section, configure the following conditions:
Request Item.Order Guide is Onboarding
Short Description starts with Validation Task
State changes to Closed Skipped
This ensures that the rule only applies to tasks related to the Onboarding request, where the short description starts with "Validation Task," and the state is being set to "Closed Skipped."
Add Action (Message)
In the Actions tab, under Message:
Add Message: Yes
Message: Only Close Incomplete or Close Complete Allowed
This will show a message when a user attempts to set the state to "Closed Skipped."
Abort the Action
In the Actions tab, check the Abort Action checkbox.
This will prevent the state change if the task is being set to "Closed Skipped."
Outcome:
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
