- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 10:44 AM
Hello,
In the Checking - Out Shopping Cart of SERVICE PORTAL , only the User's Name comes by default in Requested For field , so it's confusing if we have 2 - 3 users of same name. Also, we cannot browse like in standard service catalog to check user's details or hover on i icon to know the same in SERVICE PORTAL.
Is there ANY way in which we can add User ID / User Email there for proper identification ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 12:09 PM
We had the same scenario and to fix this you need to do this
Note: the OOTB widget has a bug unfortunately that doesn't allow you to simply create a new template, I tried. I'll put in a ticket for this since it probably effects more people. The overall issue is that the widget expects the option carttemplate but the widget option is cartTemplate. This appears to be case sensitive, so you can't just create a new template and i don't want to edit the OOTB widgets in case we need to revert some time.
Clone the widget and fix a bug
- Clone the SC Shopping Cart widget to My SC Shopping Cart
- Click the hamburger menu (the 3 horizontal lines in the top right)
- Click Edit option schema
- Change Name
- From: cartTemplate
- To: carttemplate
Copy the template
- Go to the Widget list in the platform (not the widget editor)
- Open the SC Shopping Cart widget (not the cloned one)
- Scroll to the bottom to the Angular ng-templates tab
- Open large_shopping_cart.html
- Change these properties
- ID: my_large_shopping_cart.html
- Widget: My SC Shopping Cart
- Right click the header and choose Insert and Stay to copy this to your cloned widget.
Update the template
Inside the Template code of your now copied template, scroll down until you find this code
<label>${Requested For}</label>
<sn-record-picker field="c.requestedFor" table="'sys_user'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>
Change the sn-record-picker to this to show the name and their user name.
<sn-record-picker field="c.requestedFor" table="'sys_user'" display-field="'name'" display-fields="'user_name'" value-field="'sys_id'" search-fields="'name,user_name'" page-size="100" ></sn-record-picker>
In particular you can play with display-fields, this will show the values below the name in the list as you type. You can try to mess with the values, it will hold more than one options If I recall.
Update the cart page
- Open the Page designer
- Choose the Shopping Cart [sc_cart] page
- Delete the SC Shopping Cart widget
- Add your newly created My SC Shopping Cart widget
- Click the Pencil icon to edit the options
- Under Cart Template, enter my_large_shopping_cart.html
This will use your new shopping cart template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 11:53 AM
Yes most definitely , but I hope you'll not charge me for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 12:01 PM
Sorry, Arnab, but YDS is a paid framework, available on the ServiceNow Store.
We're able to duplicate/enhance many of the baseline elements used in Service Portal for applications such as yours, which isn't a trivial exercise. My colleagues wouldn't be pleased if I gave away their hard work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 12:09 PM
We had the same scenario and to fix this you need to do this
Note: the OOTB widget has a bug unfortunately that doesn't allow you to simply create a new template, I tried. I'll put in a ticket for this since it probably effects more people. The overall issue is that the widget expects the option carttemplate but the widget option is cartTemplate. This appears to be case sensitive, so you can't just create a new template and i don't want to edit the OOTB widgets in case we need to revert some time.
Clone the widget and fix a bug
- Clone the SC Shopping Cart widget to My SC Shopping Cart
- Click the hamburger menu (the 3 horizontal lines in the top right)
- Click Edit option schema
- Change Name
- From: cartTemplate
- To: carttemplate
Copy the template
- Go to the Widget list in the platform (not the widget editor)
- Open the SC Shopping Cart widget (not the cloned one)
- Scroll to the bottom to the Angular ng-templates tab
- Open large_shopping_cart.html
- Change these properties
- ID: my_large_shopping_cart.html
- Widget: My SC Shopping Cart
- Right click the header and choose Insert and Stay to copy this to your cloned widget.
Update the template
Inside the Template code of your now copied template, scroll down until you find this code
<label>${Requested For}</label>
<sn-record-picker field="c.requestedFor" table="'sys_user'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>
Change the sn-record-picker to this to show the name and their user name.
<sn-record-picker field="c.requestedFor" table="'sys_user'" display-field="'name'" display-fields="'user_name'" value-field="'sys_id'" search-fields="'name,user_name'" page-size="100" ></sn-record-picker>
In particular you can play with display-fields, this will show the values below the name in the list as you type. You can try to mess with the values, it will hold more than one options If I recall.
Update the cart page
- Open the Page designer
- Choose the Shopping Cart [sc_cart] page
- Delete the SC Shopping Cart widget
- Add your newly created My SC Shopping Cart widget
- Click the Pencil icon to edit the options
- Under Cart Template, enter my_large_shopping_cart.html
This will use your new shopping cart template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 03:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 03:16 PM
I believe you do if you want to use a custom template. You can try with and without the change and see if it works on your end. For me I had to change it, otherwise the cart widget failed to load because it thought the variable wasn't set.
If you copied the template too for your cloned widget, you may be able to simply change the template and have everything work that route.