survey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
i have a catalog order guide named psra certificate request which when requested generates four ritm for security, vendor,privacy,software so i have a survey and trigger condition is when states changes to closed complete and item is psra certificate request or isdp general inquiry the survey should tigger but it is triggering only for isdp not for psra certificate request and survey should trigger for request on psra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@ShubhangiA77524 For sc_req_item table you can select items you want to send with OR condition.
I believe if you want to do it on request level, you will have to do it through business rule and check if request is part of order guide and then use the assessment API to trigger the survey.
Please mark the answer correct/helpful accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Yes, I want to do it on request level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In this case BR is working but survey is not triggering yet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
can you share the code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
(function executeRule(current, previous) {
if (!current.request) return;
var req = current.request.getRefRecord();
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', req.sys_id);
ritm.query();
var allClosed = true;
var psra = false;
while (ritm.next()) {
if (ritm.cat_item.name == 'Security Risk Assessment for Globe Projects and Initiatives' ||
ritm.cat_item.name == 'Software Assessment Request for Globe Projects and Initiatives' ||
ritm.cat_item.name == 'Vendor Risk Assessment for Globe Projects and Initiatives' ||
ritm.cat_item.name == 'Privacy Impact Assessment for Globe Projects and Initiatives') {
psra = true;
}
// Check if any RITM still open
if (ritm.state != 3) {
allClosed = false;
}
}
if (!psra || !allClosed) return;
gs.info('All PSRA RITMs for ' + req.number + ' are closed. Triggering Survey...');
try {
var surveySysId = '1408df6247d4fed0e9e31e1f116d438e';
var surveyAPI = new GlideRecord('asmt_assessment_instance');
var instance = new GlideRecord('survey_instance');
instance.initialize();
instance.survey = surveySysId;
instance.table_name = 'sc_request';
instance.document = req.sys_id;
instance.user = req.requested_for;
instance.state = 'ready';
instance.insert();
gs.info('Survey triggered successfully for PSRA request ' + req.number);
} catch (e) {
gs.error(' Error triggering survey: ' + e);
}
})(current, previous);
