The CreatorCon Call for Content is officially open! Get started here.

Workflow: Passing form variables between tasks within the same workflow

nmartinez
Kilo Contributor

I currently have a business rule preforming a complex function; I'd like get rid of the business rule and replace it with a workflow.

I have a catalog item that once submitted has a specific order and dynamic instructions based on the back-office interaction.

A generic example is the RITM spawns TASK 1a, based on user interaction it could spawn TASK 1B, 1C, or TASK 2A. Based on the interactions of TASK 2A it can spawn TASK 2B, 2C, 3A, 3B and so on.

Each TASK needs to pass variables to the next; such as form variables, "assigned to", and catalog variables. Now my business rule does exactly what I want it to do flawlessly; however as I want to add more complex rules I am having to rewrite parts, and it takes time.

I can't figure out how I can pull variables from within the workflow once the task is completed, and assign them to the next task without inserting more server-side scripting which is what I am trying to avoid.

Any ideas?

4 REPLIES 4

nmartinez
Kilo Contributor

I am sure I didn't explain well, so am also including a mockup screenshot of what the workflow would kind of look like. Basically each new task being created needs to get data from the previous task that ran before it.


justin_drysdale
Mega Guru

Use the workflow scratchpad to setup your vars.

http://wiki.servicenow.com/index.php?title=Using_the_Workflow_Scratchpad


Thank you, I am aware of scratchpad variables; however my hangup is pulling the values from the previous task into such variables. When TASK A is closed complete I need to pull values that are specific only to TASK A to TASK B/C/D/2A; those TASK A values are not stored in the REQ/RITM. I know I could write a gliderecord query for TASK A as soon as it is complete and then pull the values into scratchpad variables but that is what I am trying to avoid due the multiple routes the process may take and I am also trying to avoid unnecessary queries.



NeilH2
Giga Guru

Add all the variables to the catalog item and hide them (ui policy)

Then on the workflow, enter the catalog task and at the bottom you will see a variable list, move the ones you need to see on that task into the right hand column.
The list filters to the form variables if the workflow is connected to the Cat item

Remember:
UI policies don't apply on request items or tasks pre-calgery you may need to update this in the future


for example:
Task 1a requires variable1a and variable1b
Task 2a requries variable 2a

This way all the variables exist at the same time but they can be edited on the task.
and as they are updated they automatically update on the request item - no more business rule.

If your worried about users seeing empty variables on the request item i believe the SNCGuru site has some code to hide them.