
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 05:32 PM
Hi
i have a requirement about creating a survey once an incident is resolved.
the Survey is up and running however I am also asked to make it so that once the Survey is finished, the user will be redirected to the Incident that is associated with that Survey.
I found that there is a Return URL field in the Survey record.
it works just fine. However I cant seem to make it into a dynamic URL to the specific incident that is associated with that Survey.
I have tried several scripts:
/incident.do?sysparm_query=javascript:'number'=current.trigger_id
/incident.do?sysparm_query=number=current.trigger_id
/incident.do?sysparm_query=javascript:'number+'=current.trigger_id
and it still redirects to a different specific record / it states that record is not found.
If anyone has encountered and found a fix for this any help would be appreciated!
Thanks,
Justine
Solved! Go to Solution.
- Labels:
-
Benchmarks
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:08 AM
So! I shared this issue with my team and one my teammates gave me a solution for it.
Kudos to
I will share it here for other people that might encounter this same issue in the future.
the objective is that, whenever a survey is completed and closed, the user will be sent back to the incident that is associated with that survey.
so for the Survey... we realized that the return url field is actually a string field.
it could not execute javascript code or glide system functions.
therefor in order to make the return URL dynamic to each record resolved, we created a Business Rule.
This Business Rule will update the value in the return URL field every time a survey is completed and closed.
Here is the conditions for the BR to run
And here is the script
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var incidentSysID = current.trigger_id;
var metricTypeSysId = current.metric_type;
var gr = new GlideRecord('asmt_metric_type');
if (gr.get(metricTypeSysId)) {
gr.url = '/incident.do?sys_id='+incidentSysID;
gr.update();
}
})(current, previous);
This way, each time a survey is completed, the BR will update the return url field of the survey and the user will be redirected to the incident that is associated with the survey.
Again thank you very much to my teammate that helped me solve this issue.
and if you have any other suggestions feel free to reply. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:08 AM
So! I shared this issue with my team and one my teammates gave me a solution for it.
Kudos to
I will share it here for other people that might encounter this same issue in the future.
the objective is that, whenever a survey is completed and closed, the user will be sent back to the incident that is associated with that survey.
so for the Survey... we realized that the return url field is actually a string field.
it could not execute javascript code or glide system functions.
therefor in order to make the return URL dynamic to each record resolved, we created a Business Rule.
This Business Rule will update the value in the return URL field every time a survey is completed and closed.
Here is the conditions for the BR to run
And here is the script
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var incidentSysID = current.trigger_id;
var metricTypeSysId = current.metric_type;
var gr = new GlideRecord('asmt_metric_type');
if (gr.get(metricTypeSysId)) {
gr.url = '/incident.do?sys_id='+incidentSysID;
gr.update();
}
})(current, previous);
This way, each time a survey is completed, the BR will update the return url field of the survey and the user will be redirected to the incident that is associated with the survey.
Again thank you very much to my teammate that helped me solve this issue.
and if you have any other suggestions feel free to reply. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 06:19 AM
Hello,
I thought I replied with that above, but perhaps my reply didn't go through.
My apologies that none of my replies were helpful, but I'm glad you found a correct answer.
In the end, I'm glad you were able to use your very large ServiceNow network that you have at Accenture.
Take care!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!