How to trigger survey using flow designer

anvitha ash
Tera Contributor

Hi,

 

I have created a survey, now I want to trigger that survey from flow designer.

Also I need to get the response of the survey in the flow so that I can make decisions accordingly 

 

How can I trigger the survey from flow designer? Could someone help me with this scenario 

 

Thanks in advance 😃 

1 REPLY 1

Shruti
Mega Sage
Mega Sage

Hi 

1. Create a custom action to generate survey

Action inputs - metric type or survey definition sys_id , user sys_id

Action output - assessment instance sys_id

 

(function execute(inputs, outputs) {

 

var typeSysID = inputs.metric_id ;//The sys_id of the metric type or survey definition to generate assessments or surveys for.

 

var sourceRecordID = '';

 

var userID = inputs.user_id; //The sys_id of the survey respondent.

 

var result = new SNC.AssessmentCreation().createAssessments(typeSysID, sourceRecordID, userID);

 

var asmtGR = new GlideRecord("asmt_assessment_instance");

 

asmtGR.get(result.split(",")[0]);

 

asmtGR.setValue('trigger_table','<tablename>');  //table_name e.g. incident)

 

asmtGR.update();

 

outputs.survey_assessment_instance = asmtGR.getUniqueValue();

 

})(inputs, outputs);
 

2. Call the action in main flow and wait for survey completion

Shruti_0-1738043915750.png

3. Look up to "asmt_assessment_instance_question" table to get the survey responses