logo

NJP

How to add the Ordered Link Item to Order Status widget in Service Portal.

Import · Oct 01, 2019 · article

Ordered Item Link - This is an OOB field that refers to sc_ordered_item_link table. Here you could define external URLs where the user can navigate to after the item has been requested.

In most of the cases this would be:

1. Link to a survey

2. For item tracking purposes

3. if the user wishes to know more about the item that has been requested. For example - usage instructions, company policies, etc.

Before you go ahead with this implementation, I would like to inform you that this is a customization, and currently not supported by ServiceNow Technical Support Team.

The OOB portal page for Order Status does not show the Ordered Item Link as it shows in native platform UI.

The OOB portal page & platform UI for Order Status is shown as below.

Service Portal

image

Platform View

image

Here the Go to survey option is populated by the OOB field - Ordered Item Link (OOB column name - ordered_item_link)For some users, this can be used to redirect the user to a different page. For example - survey link, item tracking page etc. They would want to have field visible on the portal as well.Currently, OOB widget does not allow you to show this field, but tweaking the widget code can help you achieve this.The customizations described here is not an OOB feature of the service portal.However, users can clone their OOB order status widget and add the custom script to show the Ordered Item Link field on the catalog order status page in service portal.

Here is what you have to add on the cloned widget:

1. Create a clone of the widget: SC Order Status

2. Add the below snippets in the widget

HTML Template:

<th class="wrapper-md col-md-2" ng-if="::options.display_name === 'true'">${Order Item Link}</th><td class="wrapper-md"><a title="{{::requestItem.number}}" href={{::requestItem.order_item_link}}>Go to Survey</a></td>

Server Script:

var gr = new GlideRecord('sc_cat_item');gr.get('sys_id',reqItemGr.cat_item.getValue());var item_link = gr.ordered_item_link.getValue();var gr1 = new GlideRecord('sc_ordered_item_link');gr1.get('sys_id',item_link);var linkURL = gr1.link_url.getValue();order_item_link: linkURL,

Even though this would fix the issue, since this is a custom implementation, this is only one of the many methods to achieve this requirement.

You need to perform thorough testing before you move the enhancement to further environments.

Here are some articles which will help you in customizing the widget.

1. Add an ordered item link to an item 2. Clone a widget

3. Widget troubleshooting guide

image

View original source

https://www.servicenow.com/community/now-platform-articles/how-to-add-the-ordered-link-item-to-order-status-widget-in/ta-p/2327374