Public Survey "On Submit"

doernbrackc
Kilo Expert

With public surveys there is no TriggerID so you can't sink the response to the record which triggers the survey. Furthermore, since it's a public survey users don't have to log in which again means there is no way of linking the response to the case. What I can do is append the url with &casenum=XXXXX. What I have not been able to do is pull that number into a survey question automatically. There are articles online about this but they appear to be for express.

My new thought is if it's possible to pull this number out of the url using the UI page and when the user clicks submit, the number is sent over along with the response. Clearly when the user clicks the submit button it creates a record in SN for the survey response. Can we not add a field to that same table to hold this case number and send it over as part of the submit action?

I took a look at the UI page and given I'm not a programmer by trade, more of hacker, it looks to be pretty complex. Any thoughts on if this is possible?

1 ACCEPTED SOLUTION

Here are the screenshots of my config


Everything is pretty much OOB



survey designer.png


survey.pngmetric category.pngassessment metric.png


View solution in original post

18 REPLIES 18

Nam Nguyen
Tera Expert

Hi Chris,



If you're using the assessment, you can do the following:


1. Create a new string question, says "Case Number"


2. go into the question in form view (via Survey > Questions)


3. Make sure you're in Assessment View


4. Change "Method" to "Default answer from script"


5. In the Script field, put this: string_result = RP.getParameterValue('casenum') + '';


6. Save and try it



Let me know how you go


Screen Shot 2017-05-31 at 9.54.33 AM.png



1. Here is the script that I added on the question. Note I changed the view to "Assessment View"


2. This survey is a public survey, created with the survey designer


3. Url for testing = (https://)welltokinc.service-now.com/assessment_take2.do?sysparm_assessable_type=f7b2c74c4f1e7200ccee... . (had to put https in () )



Navigating to this url I get this:



Screen Shot 2017-05-31 at 9.59.02 AM.png


I tired this approach with a non-public survey, no luck. Have you gotten this to work yourself?


Yup here is the link to my test page and attachment is the xml of that survey


https://dev20971.service-now.com/assessment_take2.do?sysparm_assessable_type=ab2f6902db0332008de5f34...



One note is that when you test it, it is best to paste the link into a fresh new private browser session


If you open the survey link as a logged in user without the casenum, it will create a survey instance for that user with blank case number and thus if you try to open it again, it will refer back to that instance


Weird, I could not get this work unless I used Legacy Survey. Would love to see screen shots of your config.