Rafael Krindges
Kilo Guru

One request that I heard multiple times is the possibility of saving multiple "wish list" items for the same catalog item. Today, in ServiceNow out of the box (at least in Rome) you can only save one.

If you google a little bit there are a few suggestions in how to accomplish that:

https://www.dylanlindgren.com/2021/09/24/save-as-draft-record-producers-in-service-portal/

https://community.servicenow.com/community?id=community_question&sys_id=d793180e1b578010a59033f2cd4b...

Also, there are two ideas in the Idea portal requesting this improvement for ServiceNow. If you have a chance, I suggest you vote on this one.

I decided to investigate how things works and the OOB scenario is:

  • Once you Save it as wish list item the system creates a record in the sc_cart_item table;
  • The record created has a Cart name. For all wish list items, the cart name is always saved_items;
  • The record also has an Item column that represents our catalog item

All the code in the widgets SC Wish List Cart, SC Catalog Item, and in the REST Resources Submit a Record Producer and Add item to wishlist has the saved_items name hardcoded.

If instead of hard coding the name "saved_items", we create a unique cart name each time the user wants a new draft instance, it can solve our problem!!

I duplicated all the widgets/REST resources mentioned and performed the adjustments to handle at least multiple wish list items (that now I'm calling Draft List items) created by record producers.

I keep things in the same application scope (global in global, sn_sc in sn_sc) to avoid changing any permission. The "only" permission changed was in the sc_cart_item table allowing deletions triggered from other application scopes.

 

find_real_file.png

 

find_real_file.png

find_real_file.png

 

 

I attached the XML updateset to this article. I didn't load it in any instance (just exported from my dev one). If something is missing, just let me know.

For testing, after importing to your instance:

  • Edit the page sc_cat_item and replace the OOB widget SC Catalog Item with the Custom SC Catalog Item with Draft
  • Edit the page sc_wishlist and replace the OOB widget SC Wish List Cart with the Custom SC Draft List Cart

 

The version made so far only works for catalog items that are record producers. I didn't make the adjustments for all types of catalog items. I also didn't test in mobile.

 

I really appreciate any feedback and feel free to share your idea on how to achieve this business need!

Comments
jyan3
Kilo Guru

Hi I tried merging in your update set

When I place the custom SC draft list cart into my sc_wishlist I get a template error

find_real_file.png

Patrick Montgom
Tera Contributor

If you scroll down to the related list for "Angular ng-templates", open the custom_draft.html template.  Copy the contents of the template and replace the "Body HTML template" field on the "Custom SC Draft List Cart" widget with what you copied.  This should fix the error.

Michael_Nash
Tera Contributor

@Rafael Krindges 

 

Did you ever have access issues where customers could not submit the draft item?

Suresh11
Tera Contributor

Hi, We have made use of this and have an issue where an attachment added to one instance of draft is linked to all instance of the draft. Has anyone faced this issue before?

Version history
Last update:
‎10-10-2021 06:42 AM
Updated by: