Triggering an ad hoc Survey

Erik Nelson
Kilo Sage

Hello!

I have a request from an internal Team to enable triggering an ad hoc Survey. They want to be able to specify a lot of information that normally would require survey_admin or survey_creator to do, but there isn't a desire to provide either of the roles. I've reviewed the posts about using a "Send Survey" UI Action, but that still uses existing data on the form rather than letting them define things like who the survey is assigned to or what group it's about. I know if I trigger it off a Catalog Item, it gets associated to that RITM, as opposed to the record they want to send the survey from. Is it feasible to use a Record Producer because they have additional details they want to define? 

Thanks,

Erik

1 REPLY 1

Mark Endsley
Tera Guru

1. Create a business rule, and use this API.

 

https://docs.servicenow.com/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_referenc...

 

You can feed in the source ID record. So if you don't have the data stored anywhere you may need to create a related table containing that data.



It should look like this:
SNC.AssessmentCreation().createAssessments('metric_sys_id', 'record_sys_id', 'user_sys_id');

2. I would also consider storing the data as a variable when the record is created. You could do this by creating variables on the record producer that are not visible, but are auto-filled onSubmit. After that you should be able to use:

record.variables.myVar (myVar being the name of each variable)

Then you could continue to key off the record and look at the variables to retrieve the data
(I haven't tried this second idea, but I think it should work)