- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 08-22-2020 02:43 AM
Hi
Recently I walked over an interesting question in the Community, which I could not answer from top of my head, as it triggered my (the condition was met ;-)) to give this a shot and try it out while learning about it.
Scenario:
I want to have a Catalog Item with four Variables, which will NOT be filled in during "Shopping" and before Checkout, but which will be "collected" throughout different Catalog Tasks along the Workflow fulfillment process, so that - at the end - all collected data will be available.
Furthermore, I want those variables to be mandatory for capturing throughout the different Catalog Tasks.
In my example:
- in the first Catalog Task, variable #1 will be shown to be captured (not 2,3,4) and it must be mandatory
- in the second Catalog Task, variable #2 will be shown to be captured (not 1,3,4) and it must be mandatory
- in the third Catalog Task, variable #3 will be shown to be captured (not 1,2,4) and it must be mandatory
- in the last Catalog Task, ALL variables are shown and still are mandatory,
so that the 4th variable also needs to be captured
Let me walk you through the steps to accomplish this requirement.
1) Create the Catalog Item with the four Catalog Variables
Go to "Maintain Items" in the Classic UI and add a new Catalog Item. Fill in the fields (similar) to what I show below in the screenshot)

As you can see in the "Variables" Related List, I created four Variables, where you can see the first one as an example in the screenshot below. I set ALL of them to be Mandatory!

2) Hide the Variables from the Service Catalog when "Ordering"
Because I do not want to show the Catalog Variables to be filled in, when the user is in the Catalog, before CheckOut. I create a Catalog UI Policy to make the vairable "Mandatory" = "False" and "Visible" = "false" for the Catalog Item View.
On the Catalog Item in the Related List "Catalog UI Policies", I add a "New" Policy:

For this new Policy, I mark only "Apply on a Catalog Item View" checkbox.
Then I add a new record in the Related List "Catalog UI Policy Action" for each Catalog Variable.
Each Variable will be set to "Mandatory" = "False" and "Visible" = "False".
For an example of one "Catalog UI Policy Action", refer to the next screenshot:

3) Show the Variables adopted on Requested Items
Later at runtime, when the Catalog Item is requested, a Requested Item (RITM) will be created for it. In the Classic UI, I can open the Form for that RITM and I do not want to get forced to fill the Variables on that screen (make the variables NOT to be mandatory).
Furthermore, I want to SEE the content of the variables. That's why they need to be shown for Requested Items view.
To achieve this, I add another "Catalog UI Policy", like shown in the screenshot below:

Again, I need to add a "Catalog UI Policy Action" for each field separately and force the variable to be "ReadOnly" = "true" AND "Mandatory" = "False" for the Requested Item View.
Note, that there is only the Checkmark set for the "Applies on Requested Items" field.
Now we are set to play around with the Workflow and the Catalog Tasks
4) Create a new Workflow on the "sc_req_item" table
Now create the workflow, that we will attach to the newly created Catalog Item.

I just created a very simple workflow, having four Catalog Tasks in sequence:

Below, you can see, how I configured the Catalog Tasks.
The interesting thing here is, that it is very simple to allocate a Catalog Variable to the Catalog Task, which then appears at the task, and must be filled in to close the task! This way down the Workflow, the different Catalog Variables will be collected....

5) Allocate the new Workflow to the new Catalog Item
After finishing the Workflow configuration (with all the four Tasks), go back to your Catalog Item and assign this workflow to the new Catalog Item (See screenshot below):

6) Do some Test-Drive
Click on "Try It" on the Catalog Item form, to open it in the Catalog:
You can see, that NO Catalog Variable is shown here.
hat is due to the "Catalog UI Policy" Acting on the "Catalog Item" we defined first:

Click on "Order Now" (see above) to create a Request for it. The Request will be shown.
After the Resulting Request is shown, click on the Link for the Requested Item (marked yellow in the screenshot below):

On the "Requested Item" Form you can see, that all variables are shown, but you cannot edit them and they are not mandatory:

The values will now be collected throughout the next SC-Tasks.
7) Work/walk trhough the SC-Tasks in sequence
On the "Requested Item" form, scroll down to the "Catalog Tasks" Related List (see screenshot below).

Click on the marked task in the Related List to open the first (active) SC-Task (Catalog Task).
The next screenshot shows the Catalog Task, which now has the first Catalog Variable assigned.
That means, the user working on this task needs to fill in this variable before continuing.

The same steps continue to work for the remaining Catalog Tasks, and on the Last Task, I just added ALL variables, so that the results all are visible for that task.
This explains how to set up a scenario to collect data throughout the process in different variables.
I hope this will help to sort out your issue. That was a bit of work but also fun to set up 😉
Just let me know what you think about this article.
Thanks a lot in advance for your feedback and comments on this article, you can leave here below!
Thanks for marking as helpful and bookmarking - that helps me determine your interest in further articles.
Enjoy ServiceNow & BR
Dirk
---------------------------------------------------------------------
If you like to also review my other articles on the ServiceNow Community, please have a look at the overview here:
NOTE: The content I provide here is based on my own experiences and does not necessarily represent my employer's views.
- 877 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Very informative and well explained Dirk!! Cheers.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content