- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks 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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
omplete Solution with Request Item Check
If you need to verify this is specifically for the "Onboarding Request" catalog item:
Client Script (onChange):
function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } // Check if this is a validation task var shortDesc = g_form.getValue('short_description'); if (shortDesc && shortDesc.indexOf('Validation Task') === 0) { // Get parent request item var reqItemId = g_form.getValue('request_item'); if (reqItemId) { // Check if parent is Onboarding Request var ga = new GlideAjax('OnboardingTaskValidator'); ga.addParam('sysparm_name', 'isOnboardingRequest'); ga.addParam('sysparm_request_item', reqItemId); ga.getXMLAnswer(function(answer) { if (answer === 'true') { // This is an onboarding request validation task var stateLabel = g_form.getDisplayBox('state').value; if (stateLabel === 'Closed Skipped') { g_form.setValue('state', oldValue); g_form.showErrorBox('state', 'Only Close Incomplete or Close Complete Allowed'); alert('Only Close Incomplete or Close Complete Allowed for Validation Tasks'); } } }); } } }
Script Include:
- Name: OnboardingTaskValidator
- Client callable: true
var OnboardingTaskValidator = Class.create(); OnboardingTaskValidator.prototype = Object.extendsObject(AbstractAjaxProcessor, { isOnboardingRequest: function() { var reqItemId = this.getParameter('sysparm_request_item'); var ritm = new GlideRecord('sc_req_item'); if (ritm.get(reqItemId)) { var catItem = ritm.cat_item.getDisplayValue(); // Check if catalog item is "Onboarding Request" or use sys_id if (catItem === 'Onboarding Request' || catItem.indexOf('Onboarding') !== -1) { return 'true'; } } return 'false'; }, type: 'OnboardingTaskValidator' });
Hello i hope that can help
If you find this answer useful, please mark it as solution accepted/helpful
Massimiliano Micali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Reddy39 ,
so where do you get stuck and what have you tried?
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/