Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Redirect to ESC Homepage after Order guide submission

Ram33843094
Tera Contributor

After Order guide submission (checkout) page , post submission form  looks something like below(1st screenshot).

 

So skipping that request summary page. It should redirect to the ESC Homepage (2nd Screenshot).

 

Note : Order guide is submitted through HR Task (HRJ Task Submit Order guide) task type. 

 

Ram33843094_0-1684408404885.png

 

Ram33843094_1-1684408660475.png

 

Used the below 2 methods applying on Submit catalog client script, but no luck

 

// First Method

 

function onSubmit(){
function redirectToHomepage() {
window.location.href = "https://instancename.service-now.com/esc";
}
document.getElementById("ec_pro_dashboard").onSubmit = redirectToHomepage;
}

 

//Second Method

var URL = "?id=instance_URL_Link";   //Redirect part of widget sc item custom

 

top.window.location = URL;

 

@Ankur Bawiskar @Community Alums @Sandeep Rajput @AnveshKumar M 

6 REPLIES 6

Community Alums
Not applicable

Hi @Ram33843094 ,

follow the below steps:

  1. Create an after insert business rule on the Requested Item table
  2. Set the condition where order guide is <order_guide_name>
  3. In the advanced section insert the following code:
(function executeRule(current, previous /*null when async*/) {

  gs.setRedirect('<your_page_name>.do');

})(current, previous);

It should work fine!

 

Hi @Community Alums 
 
Tried already using the same as below. No it didnt work. 
 
(function executeRule(current, previous /*null when async*/) {
 
gs.setRedirect('ec_pro_dashboard.do');
 
})(current, previous);

Community Alums
Not applicable

Did it work for "ec_dashboard" ?

 

@Community Alums 

 

It still didnt work. Landing on the same request summary page after submission.