logo

NJP

Save Catalog Items as draft

Import · Mar 08, 2024 · article

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

Hi there,

Turning the Release Testing Preview (RTP) Release Notes for the Washington DC release inside out, there was a wow moment... "Let your catalog item requesters save drafts of catalog item forms so that requesters can edit the drafts later." Saving catalog items as draft, is such an often-heard question from customers!

Since the Product documentation on this subject is limited, let's dig into how "Save as Draft" works and documenting the undocumented.

Save as Draft

Viewing a random catalog item on an out-of-the-box Employee Center (and also Service Portal), you will very quickly notice the Save as Draft feature in the Order Item Section.

01.png

Save as Draft lets a user save the Catalog Item to edit it later if they don't want to discard the form. To edit a Catalog Item saved as a draft, a user can find drafts on the Request page.

02.png

Widgets, System Properties, and Table involved

As always with new Service Portal-related features, for a good chunk of customers new features will not be visible and/or won't break. The most obvious reason would be using cloned/edited Widgets.

What artifacts are involved with Save as Draft? Viewing a Catalog Item on Employee Center the "HRM Catalog Item" Service Portal Widget is used. This Widget actually gets Widget "SC Catalog Item" [id=widget-sc-cat-item-v2], which is the same Widget used on the Service Portal.

The updated Widget first checks on if on a Catalog Item Save as Draft is enabled. For this a new field on the "sc_cat_item" table has been added, "Hide 'Save' as Draft" [no_save_as_draft]. If this field is not visible on your ServiceNow instance, this might be due to form lay-out changes in the past and this should be listed within the Skipped Updates of the Washington DC upgrade.

03.png

Within the Widget Server Script also two System Properties are checked:

- System Property "glide.sc.disable.save_as_draft" should not be "true". Out-of-the-box this System Property does not exist, so should evaluate to false.

- System Property "glide.sc.enable.save_as_draft.portal." followed by the URL suffix of the Service Portal the user is on.

draft.png

If you are working on a different Service Portal, a custom Service Portal, or a Service Portal with a changed URL suffix: you can add the System Property in the format described above.

12.png

So where are the draft catalog items stored? I did see a ServiceNow Community question where one of the answers was that this is not stored_(...). Of course that's not true :face_with_tears_of_joy:. Digging into the SC Catalog Item widget, functions from Script Include _"SPCart" are called. Another part of the puzzle that got updated with the Washington DC release. Within the SPCart Script Include, several functions are performing GlideRecord queries against the Items table [sc_cart_item].

21.png

Draft catalog item

Lastly here is an example of a catalog item saved as a draft within the Items table.

22.png

And that's it, documenting the undocumented and providing a bit more technical details of what is involved with the new Save as Draft feature introduced with the Washington DC release.

---

That's it. Hope you like it. If any questions or remarks, let me know!

Kind regards,

Mark Roethof

Independent ServiceNow Consultant

9x ServiceNow MVP

---

View original source

https://www.servicenow.com/community/developer-articles/save-catalog-items-as-draft/ta-p/2855484