Survey is not triggerd based on catalog item category in RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi,
I have three survey's 'A', 'B' and 'C' so and have three categories from catalog item Category is 'X', Category is 'Y' and Category is 'Z'.
I want to send survey when state is resolved based on catalog item category from RITM (Variables) as per below screensort:
Business rule:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (current.state != 8)
return;
// Get Category variable value
var category = current.variables.category;
// If no value, stop
if (!category)
return;
// Check category and trigger respective survey
if (category == 'a') {
// Survey sys_id
var surveySysID1 = 'qewfgrhtjki2345678';
gs.eventQueue('assessment.instance.create', current, surveySysID1, current.requested_for);
}
if (category == 'onboarding_offboarding') {
var surveySysID2 = 'adwrfsg123456789';
gs.eventQueue('assessment.instance.create', current, surveySysID2, current.requested_for);
}
if(category !== 'events' || category !== 'onboarding_offboarding'){
gs.info("shilpa10");
var surveySysID3 = 'sdarferhtykyuregf12345678';
gs.eventQueue('assessment.instance.create', current, surveySysID3, current.requested_for);
}
})(current, previous);
Notification:
Trigger Condition:
But the survey is not triggered so can anyone please help on this where i missed and it will be useful.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
why are you using BR to trigger survey from script?
Directly in the trigger condition why can't you give Category condition?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
