How do I ensure that a catalog task has the latest variables from a catalog item?

MBMRED
Tera Contributor

Hi,

I'm building a workflow in Workflow Studio and my catalog item has 2 'sets' of tasks. 

  1. Initial Triage - These 3-5 sequential tasks go to different teams to make sure all the fields in the RITM are correct.  Each task owner may update or add information to the RITM based on their standard work.
  2. Execution tasks - these teams will do the work defined in the RITM after it's been updated by set 1.

My question is for the workflow in set #1.  How do I ensure that each task in set # 1 are seeing the updated information from the RITM?

 

How does "Get catalog variables" work?

  • If it's pulling the "current" variables, then I can just "get catalog variables" before each task.
  • If it's pulling the original variables, then I need to know how to get the "current variables".

 

Thank you in advance,

Mathew

 

 

3 REPLIES 3

joshuajacks
Tera Guru

@MBMRED 

If you need to use a catalog variable later in the workflow that may have changed value then doing "get catalog variables" again will pull the updated value. If you're not doing any data manipulation within the flow and letting the users make the updates then there's no real need to grab the variable values again because the newly created tasks will have the updated variable values.

Tanushree Maiti
Tera Patron

Hi @MBMRED 

 

  • To fetch a Service Catalog variable's value inside a ServiceNow classic workflow script, use the current.variables.variable_name syntax

  • In ServiceNow legacy workflows, you can pass calculated values between activities using the workflow.scratchpad object.. This object acts as a global, server-side data container that persists for the entire life cycle of that specific running workflow instance.  syntax: workflow.scratchpad.variable_name="value";

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

pr8172510
Tera Guru

Hi @MBMRED 

In general, catalog variables are stored on the RITM, so if Task 1 updates a variable and the change is saved back to the RITM, subsequent tasks can access the updated value.

For your scenario, I would test the Get Catalog Variables action by

  1. Updating a variable during Task 1.

  2. Completing the task and ensuring the value is written back to the RITM.

  3. Running Get Catalog Variables before Task 2.

  4. Verifying whether the returned value is the updated value or the original submission value.

The key point is that each task should update the RITM variables themselves rather than storing values only on the task record.

Task 1

Update RITM Variable

Save to RITM

Get Catalog Variables

Task 2 reads updated value

 

If the variables are being updated directly on the RITM, subsequent workflow activities should be able to work with the latest values.