How to 'reference' a Service Portal Catalog Item vs. the same CMS Catalog Item.

Wesley Breshear
Tera Expert

Hello,

Still a beginner at JavaScript and have no clue how to modify the script below.   This is an out-of-the-box script (I believe) on the ServiceNow New Call module.   When the Service Desk selects "Request" as the Call Type and then selects the appropriate Request Item.   They then can use the Submit Call button which executes the script below and they are redirected to the Request Item on the CMS side of ServiceNow.   I would like to have the referenced catalog item direct the Service Desk agent to the Service Portal vs. CMS UI.   Could you please assist how this could be coded?

// Submit button for New Call

answer = current.insert();

gs.include('ActionUtils');

var au = new ActionUtils();

au.postInsert(current);

// After New Call is created take agent to Incident record.

if (current.call_type == 'status_call'){

gs.setRedirect("incident.do?sys_id=" + current.transferred_to);

}

Service Portal Cat Item.jpg

Thank you,

-Wesley

1 ACCEPTED SOLUTION

Matthew Glenn
Kilo Sage

Check out the CallTypeChanged to Request business rule on the new_call table




In the script field, look for the following line (should be line 9):



var url = "com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=" + reqItem



Comment that line out and add the following beneath it:



var url = "sp?id=sc_cat_item&sys_id=" + reqItem



Depending on the name of your portal and catalog item page, you may need to adjust the above slightly.



Leave the rest of the code as is. It's not needed with the change you're making, but it's not doing any harm either.




Save and you should be set.


View solution in original post

2 REPLIES 2

Matthew Glenn
Kilo Sage

Check out the CallTypeChanged to Request business rule on the new_call table




In the script field, look for the following line (should be line 9):



var url = "com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=" + reqItem



Comment that line out and add the following beneath it:



var url = "sp?id=sc_cat_item&sys_id=" + reqItem



Depending on the name of your portal and catalog item page, you may need to adjust the above slightly.



Leave the rest of the code as is. It's not needed with the change you're making, but it's not doing any harm either.




Save and you should be set.


Hi Matthew,



Awesome, thanks!   Works great.



I was thinking the UI Action was controlling everything.   Didn't even think about looking for a Business Rule.



Thanks again.


-Wesley