Redirecting URL in Business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 03:17 AM
Hi Community,
I'm trying to write a Business Rule that creates a new Problem record after changing Incident State to On Hold and On Hold Reason = awaiting Problem
How can I redirect the page to the new Problem Record ? I tried gs.setRedirectURL(); and gs.setRedirect(); and the two methods were failed
Below the script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 03:24 AM - edited 02-07-2024 09:43 PM
Try this :
var gr = new GlideRecord('problem')
gr.initialize();
gr.short_description = current.short_description;
gr.description = "Problem created from incident "+current.number+" which its State changed to On Hold";
gr.assignment_group = current.assignment_group;
gr.insert();
gs.addInfoMessage("Problem "+gr.number+" is created after changing incident "+current.number+" to On Hold");
gs.setRedirectURL('build your record url here');
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 04:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 09:43 PM - edited 02-07-2024 09:44 PM
Hi @Khaled RAJHI,
May i know what type of business rule your using ? You must be using Async business rule for this... Because we have 2 operations happening >> 1 the incident itself if receiving the changes 2. A new record is being created on incident changes...
So here you go to Wait for incident updation first...
Alternatively, Instead of creating a business rule for redirection you can use gs.addinfomessage() to show your newly created problem as hyper link... by which user can be redirected. (You also have OOTB Problem field on incident record to check the problem creation...)
var gr = new GlideRecord('problem')
gr.initialize();
gr.short_description = current.short_description;
gr.description = "Problem created from incident "+current.number+" which its State changed to On Hold";
gr.assignment_group = current.assignment_group;
gr.insert();
gs.addInfoMessage("Problem "+gr.number+" is created after changing incident "+current.number+" to On Hold");
gs.setRedirectURL('build your record url here');
I hope this help...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 11:58 PM
Hi,
Im using an "After" Business Rule with conditions
Incident State = On Hold
On Hold Reason = Awaiting Problem
I want that after saving incident, the page is redirected automatically to the new created Problem Record, I tried
gs.setRedirectURL('/problem_list.do?sysparm_query=active%3Dtrue&sysparm_view=');
and nothing has changed, the page still on incident form