
- 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-10-2022 05:49 PM
Hi,
If this field is anything like most other fields in the platform, your format would need to be:
javascript:"/incident.do?sysparm_query=sys_id="+current.trigger_id;
This of course is assuming you've done due diligence and saw that current.trigger_id results in a sys_id.
You can try that and see if it works?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 07:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 07:26 PM
Hi,
Hmm, you could set that return URL validation business rule to not execute on the specific assessment metric in question and see if it works as I mentioned without that?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2022 06:42 PM
Yes I did. At one test I even tried deactivating the whole BR.
while it DID let me save the survey like that.... once i finished taking the survey nothing happened. fortunately the response IS recorded , However once I click the submit it just turns gray and nothing happens.
the instance isnt loading or anything. Its broken.