In Flow designer, how do I get the sys_id of a catalog task I am creating

Dustin Spain
Tera Contributor

In workflow when I am creating a catalog task with 'wait' checked, I can write this line of code in the advanced script field to record the sys_id of the new task to the scratchpad.

workflow.scratchpad.sctask_id = task.setNewGuid();

How do I get this sys_id in Flow designer?

8 REPLIES 8

Allen Andreas
Administrator
Administrator

Hi,

You should be able to dot-walk to it using this:

fd_data.

As you press the . the prompt pops up and you can select values from that and walk it along. I believe you can keep dot-walking it to get the value.

Try it and see it that helps!

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen Thanks for the reply.  This doesn't seem to work for me.

When I am creating task1 I need it to be aware of its own sys_id.  There is no script field other the ones for setting a specific field.  I tried dot walking to itself with fd_data. and that did not work.

I then tried the same thing but in task2 (which doesn't really help me) and I got the same error:
find_real_file.png

Hi @Dustin Spain 

Perhaps you can give us more information where you're trying to use this?

If you're trying to use the value somewhere else, then you can create a flow variable, then use the set flow variable flow logic and simply choose the flow variable you created and drag the "create task > sys_id" pill over to it and that's it, it's ready for use somewhere else.

In the "wait" scripting field of the catalog task, you do have access to scripting, but you must return a value there. Without you sharing your script, we can't really help. As you see in the scripting field it says: Script must return a value.

In any case, you wouldn't need to use that script field to grab the sys_id and associate it to a workflow scratchpad variable, when you can use a flow variable and then assign it.

https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/flow-designer/concept/fl...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Using a flow variable to record the sys_id of the task is exactly what I want to do.  The Flow is for IT Procurement purposes and the task is a 'Place order' task.  When we get the order confirmation email from our vendor, I want the inbound email action to query for the correct task by sys_id and close it.