
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2017 01:41 AM
Hi
OK, I'm pretty new at this, and I am building a survey where I can write a value in a url variable with the survey link and have the survey form pick it up in a string field (preferable read-only).
For instance, a case number:
https://<link to survey>&casenumber=FF012345
I manage to view the field Default Answer in the form by removing the conditions regarding when to apply under "Show and hide default value field", but that just gives me an uneditable empty drop-down field, so I suspect I'm on the wrong track
So "all i need" is to be able to put some magic into that field and have it pick up the casenumber variable. Or another idea.
Best regards
Per
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 07:51 AM
you can use the sysparm_query property to set the values
https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=priority=1^incident_state=3
you can set this values dynamically from email notification while sending survey like below.
https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=assigned_project_title=${short_description}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2017 02:03 AM
Hi Per,
Have a look at the below code, it should run during on Load of the page and should fetch you the 'casenumber' from URL
<code>
function onLoad() {
var caseNumber = getParmVal('casenumber');
alert('caseNumber : '+caseNumber);
}
function getParmVal(name){
try{
var url = document.URL.parseQuery();
if(url[name]){
return decodeURI(url[name]);
} else {
return;
}
}
catch(e){
jslog('Exception ' + e);
}
}
</code>
Do post if you have further questions.
Regards
Deepak Kanavikar
( Hit like, Helpful or Correct depending on the impact of the response )

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2017 02:31 AM
Hi Deepak
Thanks for that. That fetches the variable from the url, but I still need to transfer the value to the string field.
I need the value to be saved with the survey response.
Best regards
Per
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 07:28 AM
Did you get anywhere with this? I am trying to do something very similar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 07:51 AM
you can use the sysparm_query property to set the values
https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=priority=1^incident_state=3
you can set this values dynamically from email notification while sending survey like below.
https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=assigned_project_title=${short_description}