service portal two step check out widget configuration

Siris
Tera Contributor

Hi, How can I configure the Order confirmation widget, requested for 

1.  First it shows email address instead of User name

2.  How to make it read only or

Siris_0-1777561935723.png

 

any other changes 

2 REPLIES 2

GlideFather
Tera Patron

Ahoy @Siris,

 

i don't think there's easy way to make it read-only, because if you do (somehow) it will impact all the catalog items and it is not a good idea.

 

Why would you make it read-only? WHat's the benefit of it?

_____
Answers generated by GlideFather. Check for accuracy.

Naveen20
ServiceNow Employee

@Siris Please try the below on the widget - sp_widget_1efb954a7f900300688e91679ffa91f8

Clone the OOB Catalog Checkout widget, then make 3 changes

Compare and replace in html (email put in place)
<sn-record-picker ng-if="!c.data.ignoreTableACL" id="requested-for"
field="c.requestedFor"
table="'sys_user'"
display-field="'email'"
display-fields="'email'"
value-field="'sys_id'"
search-fields="'email,name,user_name'"
default-query="c.data.reqForQuery"
page-size="100"
options="{allowClear : false}"
sn-disabled="true">
</sn-record-picker>

<sp-reference-element ng-if="c.data.ignoreTableACL"
sn-select-width="100%"
field="c.requestedFor"
glide-form="c.requestedFor.g_form"
display-column="'email'"
allow-clear="false"
sn-options="{multiple: false, allowClear: false}"
sn-disabled="true">
</sp-reference-element>


### Script — add after data.reqForQuery

if (data.cart && data.cart.requested_for) {
var grUser = new GlideRecord('sys_user');
if (grUser.get(data.cart.requested_for))
data.cart.requested_for_display_name = grUser.getValue('email') || grUser.getDisplayName();
}

 Swap the widget on the sc_catalog page with your clone or change as is to apply for all

sn-disabled="true" makes it read-only; the display-field='email' + server override makes email show on both initial load and selection.