Employee Center:After submitting the catalog item, redirect to the RITM page instead of the REQ page

Elton2
Tera Contributor

Hi everyone, how are you?

 

When a user submits a Catalog Item, the next page is the REQ (img_1), but I would like the user to be redirected to the RITM page (img_2) after submitting a Catalog Item.

 

1) I cloned the "Ticket Conversations" widget
2) I created a "ticket_conversation_clone" page
3) I added this script to the server: (img_3)

if (data.table == 'sc_request') {
var item = new GlideRecord('sc_req_item');
item.addQuery('request', data.sys_id);
item.query();
if (item.next()) {
data.sys_id = item.sys_id;
data.table = 'sc_req_item';
}
}

 

4) I created a "Page Route Maps" (img_4)

5) However, when I submit a catalog item, the REQ still appears (img_5)

 

Note: I read this suggestion: https://www.servicenow.com/community/itsm-articles/redirect-to-requested-item-ritm/ta-p/2300997/show...

 

I downloaded the Update Set > uploaded it > created the property (x_295070_req2ritm.redirect_override), but
it didn't work!

 

I wonder if anyone has any suggestions regarding Employee Center Portal?

Thanks so much 😉

4 REPLIES 4

Hi @Rafael Batistot, how are you?

 

I cloned the "Ticket Fields" and "Ticket Conversation" widgets, then made the following adjustments:

1) Ticket Fields Clone (Server Script) lines 4 to 13 (img_ticket_fields_clone):

 

var gr = $sp.getRecord();
var sys_id = $sp.getParameter("sys_id");
var table = $sp.getParameter("table");
if (table == 'sc_request') {
var item = new GlideRecord('sc_req_item');
item.addQuery('request', sys_id);
item.query();
if (item.next()) {
gr = item;
}
}

 

2) Ticket Conversation CLONE (Server Script) line 56 to line 65 (img_ticket_conversation_CLONE):

if (data.table == 'sc_request'){
var item = new GlideRecord('sc_req_item');
item.addQuery('request',data.sys_id);
item.query();
if (item.next()) {
gr = item;
data.sys_id = gr.sys_id;
data.table = 'sc_req_item';
}
 
Next, I created a "Page Route Map"  (img_4) for a page I created called "ticket_conversation_clone" and
included the two widgets "Ticket Conversation CLONE" and "Ticket Fields Clone." I tested it by submitting a new Catalog Item, but it didn't work (img_ticket_conversation_clone PAGE).
 
Note: I would like to know if you tried this and if it worked for you?
Thanks for your attention!
 
 
 
 

@Elton2 

 

Yes, this approach can work — I’ve done the same for cases where we wanted requests to open directly into their first RITM in a custom page. But it usually fails if:

 

  • The table/sys_id aren’t passed in properly through the route map, or
  • The page is opened with only the Request sys_id, and the widget never finds a matching RITM (for example, if the catalog item submission hasn’t yet generated the RITM).

My suggestion:

Before testing again, open your page URL like this:

 

/sp?id=ticket_conversation_clone&table=sc_request&sys_id=<request_sys_id>

 

and add a debug log in your clone’s server script:


gs.info("DEBUG >> incoming table=" + table + " sys_id=" + sys_id);

 

This will tell you immediately whether the parameters are arriving correctly.

 

Hi @Rafael Batistot , 

 

1) Page URL: sp?id=ticket_conversation_clone&table=sc_request&sys_id=6375265083c07610c8ee9d60ceaad318 (img_01)

 

2) I put the debug in the Widgets Server Script "Ticket Fields" and "Ticket Conversation CLONE", but only recognized the latter (img_02).

 

3) Page containing the 2 widgets (img_03)

 

Thanks!