How to redirect to New page after submitting catalog item request on ESC portal

RasikaG
Tera Contributor

Upon submission the user should be redirected to a page that displays "Thanks for your feedback – Please note you are not opening a Request! 

1 ACCEPTED SOLUTION

Rushi Savarkar
Kilo Sage

Hello @RasikaG 

1. You need to clone the "SC Order status widget".

2. In the server script, you need to add the following code at the top of the script:

var catalogItemToSkip = '6d0f8e1c81df2500772e95d75e286264'; //paste your catalogItem sys_id here

if (request_id) {
  var skipWidget = false;
  var reqItem = new GlideRecord('sc_req_item');
  reqItem.addQuery('request', request_id);
  reqItem.query();
  while (reqItem.next()) {
    if (reqItem.cat_item.toString() === catalogItemToSkip) {
      skipWidget = true;
      break;
    }
  }
  if (skipWidget) {
    return; 
  }
}

3. In the HTML section, add your message at the top with the required conditions

4. After submitting the catalog item, you will be redirected to the sc_request page

5. Press Ctrl + right Click and open the Page in Designer

6. In the filter, search your cloned widget
7. Drag & drop to the page
8. Delete the previous "Request not found" widget 

9. You can test if your requirement is fulfilled or not.

 

Please let me know if you have any questions.

Thank you!

If my response helped you, please accept the solution and mark it as helpful.
Thank You!

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@RasikaG 

you can check this link which talks about something similar where solution was shared recently

How to redirect a User to a custom page when a particular catalog item is ordered instead of defaul... 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Rushi Savarkar
Kilo Sage

Hello @RasikaG 

1. You need to clone the "SC Order status widget".

2. In the server script, you need to add the following code at the top of the script:

var catalogItemToSkip = '6d0f8e1c81df2500772e95d75e286264'; //paste your catalogItem sys_id here

if (request_id) {
  var skipWidget = false;
  var reqItem = new GlideRecord('sc_req_item');
  reqItem.addQuery('request', request_id);
  reqItem.query();
  while (reqItem.next()) {
    if (reqItem.cat_item.toString() === catalogItemToSkip) {
      skipWidget = true;
      break;
    }
  }
  if (skipWidget) {
    return; 
  }
}

3. In the HTML section, add your message at the top with the required conditions

4. After submitting the catalog item, you will be redirected to the sc_request page

5. Press Ctrl + right Click and open the Page in Designer

6. In the filter, search your cloned widget
7. Drag & drop to the page
8. Delete the previous "Request not found" widget 

9. You can test if your requirement is fulfilled or not.

 

Please let me know if you have any questions.

Thank you!

If my response helped you, please accept the solution and mark it as helpful.
Thank You!