When user clicks on approve ui action they are getting redirected to a different page. But they should be re directed to the same page.

Rajesh PanneerS
Tera Contributor

When user clicks on approve ui action they are getting redirected to a different page. But they should be re directed to the same page.Below is my code, but it's not working.

current.approval = "approved";
current.update();

new UIActionUtils().approvalsNoLongerRequired(current.sys_id);
action.setRedirectURL(current);

1 ACCEPTED SOLUTION

action.setRedirectURL(current);   should be used before current.update();



action.setRedirectURL(current);


current.approval = "approved";
current.update();


new UIActionUtils().approvalsNoLongerRequired(current.sys_id);




If this doesn't work, then there might be some error and you should check error logs.


View solution in original post

5 REPLIES 5

manikorada
ServiceNow Employee
ServiceNow Employee

Rajesh,



Can you do something like :


action.setRedirectURL(current);


current.approval = "approved";
current.update();


new UIActionUtils().approvalsNoLongerRequired(current.sys_id);


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Rajesh,



For testing purpose can you remove this line and test once.


new UIActionUtils().approvalsNoLongerRequired(current.sys_id);


Hi Pradeep,



It doesn't work, when I approve it get redirected to a different change ticket.


Rajesh PanneerS
Tera Contributor

Hi,


Can anyone help me on this