Access a Flow Action "Variables" from an EXTERNAL scriptI

poyntzj
Kilo Sage

I am rebuilding an old Workflow Activity.  The WF activity used to run and read the Workflow Scratchpad to store data and use that in processing via an external Script.

 

I have reworked this via 2 methods for Flow Designer, but at the moment both are using a custom table which I'd prefer to eliminate.

I can see from the Flow Action that the running version resides in sys_flow_context, and the data in the variables can be read from sys_flow_value (does need an ACL change to let me check - but easy to address)

 

What I need to do is, from within my Flow Action is to call a Script Include and pass the sys_id of this now running flow_engine_context record.

eg:

 

new ScriptIncludeName().doSomething(fd_data.sys_id)

new ScriptIncludeName().doSomething(current.sys_id)

 

In a Script Step in a Flow Action, I am constantly getting fd_data is undefined, current is always null, this.sys_id = null

 

Anyone got any ideas on how to do this

1 ACCEPTED SOLUTION

poyntzj
Kilo Sage

So, to get the ID of the current context (probably bad phrasing on my behalf)

 

var contextId = FlowScriptAPI.getContextID();
return contextId;

 

This allows me to get the ID of the running script action from a Script Include to do what I require

View solution in original post

3 REPLIES 3

Lithesh
Kilo Sage

Hi @poyntzj ,

 

Follow the images that I have attached,
img 1.pngimg2.pngimg3.png

 

Let me know if you any doubts and if you find this is useful don't forget to accept solutions.

 

Thanks,

Lithesh

That is fine within the confine of the Flow or Script action,. but not if I want to do something with the flow from an external process such as a Script Include - which I do

poyntzj
Kilo Sage

So, to get the ID of the current context (probably bad phrasing on my behalf)

 

var contextId = FlowScriptAPI.getContextID();
return contextId;

 

This allows me to get the ID of the running script action from a Script Include to do what I require