- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2020 05:02 AM
Hello Team,
Please help me on this issue creating Survey button incident form.
- I have created Survey Button on incident form but it's not triggering the survey. I have written script and condition but not working.
- I wanted this button should visible only when state is closed and visible only for ITIL users.
Condition : current.active && (gs.hasRole("itil") || gs.hasRole("admin"))
Script :
var sourceRecordID = ' '; //Actually just leave this as an empty string
var userID = current.caller_id.sys_id; //One or more comma-separated sys_ids of users to send assessment or survey instances to. If this parameter is left blank, the assessment stakeholders or survey users receive instances. This parameter is required for on-demand assessments.
var result = new SNC.AssessmentCreation().createAssessments(typeSysID, sourceRecordID, userID);
asmtGR.get(result.split(",")[0]);
asmtGR.setValue('trigger_id',current.getValue('sys_id'));
asmtGR.setValue('trigger_table','incident');
asmtGR.update();
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2020 04:08 AM
Hello team,
I have tried below script it worked for me.
var gr = new GlideRecord('asmt_assessment_instance');
gr.addEncodedQuery('metric_type=99471f319f0312006371f84bc42e70f1^user='+current.caller_id+'^trigger_id='+current.sys_id); //Here in the metric_type add the sys_id of your Survey from 'asmt_metric_type' table
gr.query();
if(gr.hasNext()){
gs.addErrorMessage("Surevy already sent to user!");
//current.setAbortAction(true);
action.setRedirectURL(current);
}else{
var Link =(new sn_assessment_core.AssessmentCreation()).conditionTrigger(current,'249e70b0875013005d90bba826cb0bbf');
gs.addInfoMessage(" successfully assigned survey to caller");
action.setRedirectURL(current);
}
Thanks all for your help.
Thanks,
JRY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2020 03:38 AM
Hi Ankush,
Can you help me how to trigger survey with event and records should be inserted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2020 04:08 AM
Hello team,
I have tried below script it worked for me.
var gr = new GlideRecord('asmt_assessment_instance');
gr.addEncodedQuery('metric_type=99471f319f0312006371f84bc42e70f1^user='+current.caller_id+'^trigger_id='+current.sys_id); //Here in the metric_type add the sys_id of your Survey from 'asmt_metric_type' table
gr.query();
if(gr.hasNext()){
gs.addErrorMessage("Surevy already sent to user!");
//current.setAbortAction(true);
action.setRedirectURL(current);
}else{
var Link =(new sn_assessment_core.AssessmentCreation()).conditionTrigger(current,'249e70b0875013005d90bba826cb0bbf');
gs.addInfoMessage(" successfully assigned survey to caller");
action.setRedirectURL(current);
}
Thanks all for your help.
Thanks,
JRY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 06:59 AM
Hi Chaitanya,
I was trying the above code, could you please let me know from where have you taken the second sys_id (249e70b0875013005d90bba826cb0bbf) from?
Thanks