How to check survey to finish and add that condition to workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 09:48 PM
Hello guys,
I have a requested item and in stage 1 it creates catalog task. In the catalog task I have configured a survey.
In the requested item workflow I need to check surveys to finish and automatically close that task.
Currently I added wait for condition after catalog task creation script and it stuck on the wait for condition.
Here is my wait for condition script.
// Set the variable 'answer' to true or false to indicate if the condition has been met or not.
//New employee first day questionnaire (Requester)
var metricType = 'd039d2d4db5c9d102439aa4dd39619bb';
var grInstance = new GlideRecord('asmt_assessment_instance');
grInstance.addQuery('trigger_id', current.sys_id);
grInstance.addQuery('metric_type', metricType);
grInstance.addQuery('state', 'complete');
grInstance.query();
if(grInstance.hasNext()){
answer = true;
}
else{
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 09:28 PM
Hello,
Just to be sure you have applied the other condition as correct. Can you apply the add query filters in the filter of asmt_assessment_instance table and check the the filter actually gets you the correct survey result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 02:21 AM
Hello, Saurav11,
I think grInstance.addQuery('trigger_id', current.sys_id); line is failing at getting sys_id of RITM.
I have tried to set sys_id to var sysid and tried this version:
var metricType = 'd039d2d4db5c9d102439aa4dd39619bb';
var sysid = current.sys_id;
current.work_notes = sysid +'';
var grInstance = new GlideRecord('asmt_assessment_instance');
grInstance.addQuery('trigger_id', sysid);
grInstance.addQuery('metric_type', metricType);
grInstance.addQuery('state', 'complete');
grInstance.query();
if(grInstance.hasNext()){
answer = true;
}
else{
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 03:08 AM
Hello,
Is it working now? can you apply log and check if sysid is getting printed correctly?