Make SC Catalog Item 2 widget for service portal open one specific catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 07:39 AM
Hi all
I have a requirement to make a copy of the SC Catalog Item 2 widget and code it to open one specific catalog item only. This is because we are creating a separate portal that will be set to public, with one landing page which will also be set to public, and on that page will be the copy of the SC Catalog Item 2 widget which will also be set to public. We want that widget to display one particular catalog item form which will be completed by people outside of our organisation.
Currently, the SC Catalog Item 2 widget is passed the sys id of whichever cat item/ record producer the user clicks on via the SC Category page widget (or a group of other widgets I think e.g. popular items etc). If anyone knows what I would need to do to the code of the SC Catalog Item 2 widget to set it to open one specific catalog item every time, without the user first clicking on an item on the SC Category page widget, that would be great!
Thanks in advance
Sarah 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 01:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 03:20 AM
Not very sure on this part.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022 01:30 PM
ok, let's get backwards, you are getting error
You are either not authorized or record is not valid.
in server script this is on line 140
m.invalidRecordMsg = gs.getMessage('You are either not authorized or record is not valid.');
I found calling this message in HTML on line 260
<div ng-if="::!data.recordFound" class="alert alert-info">{{::m.invalidRecordMsg}}</div>
so this happens when data.recordFound is false, let's get back to server script and I have it on lines 170, 217, 225
data.recordFound = false;
since this is where your and my widget behaves differently I can't help you much further
what I would do is to add some logging into each branch to see which way the script is going and then put in the logging also the values the script is working with to find where the culprit is
Just out of curiosity, can you open the page in different portal to see whether it also throws this error? To make sure there isn't any issue with portal settings or something, e.g.
I have my page with this cloned widget on SP portal called 'sc_cat_item2' but I open it on ISC portal
https://instancename.service-now.com/isc?id=sc_cat_item2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 09:53 AM
Somewhat new to Service Portal config - same issue. On Rome release, does not matter what catalog item I point to, result is message "You are either not authorized or record is not valid". If I use icon link to just put a link to the catalog item on the page, it lets you get to the same catalog item via portal just fine. Design requirements are same as original author though, simply want a portal page that does nothing other than display form and ability to order a single catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2022 11:29 AM
I opened a case with support as I was under a bit of a tight timeline and got a response which resolved my issue. response summary:
"The problem here is that data.sys_id ends up not being populated when it is eventually invoked to populate the catalog item object - the easiest way to fulfill this requirement is to create an option with name set to: 'sys_id' (screenshot attached). After doing that, your catalog item did not need URL parameters or anything to load and was the only catalog item on the page."
the technician included the following screenshot which didn't clear things up for me re: where in the Server Script it's calling sys_id (this is unchanged from OOB apart from Jan's recommendation in his second step)
So, from Jan's post, as opposed to inserting a new Option to refer back to Catalog Item, instead insert one that refers to Sys ID and then plug in the sys_id of the catalog item you want to bring up:
When I removed Option that I had added re: reference to Catalog Item and replaced it with example above, my cloned SC Catalog Item 2 widget was now working.
Hope this helps you.
Andrew