- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 07:59 AM
Hi guys,
Note: I'm the new guy, trying to learn some ServiceNow development 🙂
I'm trying to figure out how, to use the already presented delivery time on sc_cat_item to define the delivery time shown on the service portal. I have figured out that the delivery time shown on the service portal comes from the workflow properties, the item uses.
The thing is, we / my company have hundreds of items using the same workflow, and i would really like to differentiate between the delivery time of these.
How can that be done?
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 11:43 AM
You could could clone the SC Catalog Item Widget and modify it to include some code like this near the end of the Server Side script:
var cat_item = new GlideRecord('sc_cat_item');
cat_item.get($sp.getParameter("sys_id"));
if(cat_item.getDisplayValue('delivery_time')) {
data.sc_cat_item.estimated_delivery_time = cat_item.getDisplayValue('delivery_time');
}
In mine I put it right above the closing })()
Assuming you don't want to modify the out of the box pages (which I would strongly advise against)...
You would then clone the sc_cat_item page and replace the SC Catalog Item widget with your modified one.
You'd need a Page Route Map to direct from sc_cat_item to your new page.
Otherwise, just replace the SC Catalog Item widget on the sc_cat_item page with your modified one
Basically this code would check to see if you have set a value on delivery_date on the item itself and display that value in the portal, otherwise it will use the calculated value based on the workflow that is set.
Hope this helps!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 11:23 AM
Switch to a FLOW, build a new Action that calculates the delivery date based on the delivery time set in that field. Have it populate on the RITM so it shows on portal for end user.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2020 11:43 AM
You could could clone the SC Catalog Item Widget and modify it to include some code like this near the end of the Server Side script:
var cat_item = new GlideRecord('sc_cat_item');
cat_item.get($sp.getParameter("sys_id"));
if(cat_item.getDisplayValue('delivery_time')) {
data.sc_cat_item.estimated_delivery_time = cat_item.getDisplayValue('delivery_time');
}
In mine I put it right above the closing })()
Assuming you don't want to modify the out of the box pages (which I would strongly advise against)...
You would then clone the sc_cat_item page and replace the SC Catalog Item widget with your modified one.
You'd need a Page Route Map to direct from sc_cat_item to your new page.
Otherwise, just replace the SC Catalog Item widget on the sc_cat_item page with your modified one
Basically this code would check to see if you have set a value on delivery_date on the item itself and display that value in the portal, otherwise it will use the calculated value based on the workflow that is set.
Hope this helps!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2020 11:19 AM
Thanks, worked like a charm!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 08:10 AM
Hello @Michael Jones ,
I'm getting the below error,
Server JavaScript error Cannot set property "estimated_delivery_time" of undefined to "2 Days"
Could you please suggest on this.
Thanks,
Kiran