Create your script in ProcFu and save it with a name.

Use the payload variable to access any payload you’re passing.

Use return to return a value to your flow.

Eg:

Screenshot_2022-06-07_08-04-44.png

Then from PWA, use call_procscript to run your code and get a return value, eg:

Screenshot_2022-06-07_08-06-47.png

Note that Citrix Podio Automation requires results as text, so any objects or arrays that your code returns will be JSON encoded.

Naming your Code

Since there is no concept of a name when passing code from an automation, it is best to have the first line of your code as a comment to be able to differentiate it in your ProcFu stats later. Eg:

// Calculate something
x = [(Variable) foo]
// rest of code ...

It is technically not required to name your code, but in the absence of the first line comment, your stats in ProcFu will use keywords from the start of the code, which will be confusing and if there's a GlobiFlow token there, each execution will create a new stats "object".

The Chrome extension will enforce the first line comment for you.

Long Running Code

Note that for long running scripts (longer than 30 seconds), PWA will hang up the connection after 30 seconds and you’ll get an error.

To get around this, you need to use call_procscript_bg which will launch your script in the background. This will not return any values.

Your script would therefore need to do something to announce it’s completion and return values at the end. Usually we recommend triggering a PWA flow using pwa_trigger_flow_on_item