Description
This article describes how to get the value from non default fields in SC Catalog Item widget and display them in Service Portal
Procedure
- Clone the OOB SC Catalog Item widget.
- In Server script of widget code, add the below lines after Line 65 :
var catTest = $sp.getParameter('sys_id'); // to get the sys_id of the catalog item from Portal URL
var gp = new GlideRecord('sc_cat_item');
gp.addQuery('sys_id',catTest);
gp.query()
while(gp.next()) {
data.stest = gp.getValue('u_stesting');
}
In this case, u_stesting is the custom string type field created on sc_cat_item table, that needs to be displayed in Service Portal
3. Now in the Body HTML Template of the widget, below
<div class="text-muted sc-cat-item-short-description" ng-if="::data.sc_cat_item.short_description">{{::data.sc_cat_item.short_description}}</div>
add
<p>Test {{::data.stest}} </p>
4. Use the cloned version of the widget in sc_cat_item or any custom page used in Service Portal used to display the catalog item
Applicable Versions
Any supported release