Redirecting URL in Business rule

Khaled RAJHI
Tera Contributor

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 :

    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(gr); Failed
    gs.setRedirect(gr); Failed
8 REPLIES 8

Anand Kumar P
Giga Patron
Giga Patron

Hi @Khaled RAJHI ,

Try below one

action.setRedirectURL(url);

action.SetRedirectURL(url);

gs.setRedirect(url);

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

I try the three suggestions and all are failed, please note that it's an After Business Rule

action.setRedirectURL(gr);

action.SetRedirectURL(gr);

gs.setRedirect(gr);

hemuvirat005
Tera Contributor

var redirectURL = "/problem.do?sys_id=" + gr.sys_id;

gs.setRedirectURL(redirectURL);

 

add this to your script and let me know if it works

Hi @hemuvirat005 

lines added to script and nothing has changed, the page is not redirected to the new created problem record