Running ProcScript from Citrix Podio Workflows
There are 2 main methods to run ProcScript code from PWA:
- As a saved script via a PF script
- As raw code in a POST brick
Saved Script
This is the preferred way of running ProcScript from PWA.
Create your script in ProcFu and save it with a name.
Use the parameters
variable to access any payload you’re passing.
Use return
to return a value to your flow.
Eg:
Then from PWA, use call_procscript
to run your code and get a return value, eg:
Note that Citrix Podio Automation requires results as text, so any objects or arrays that your code returns will be JSON encoded.
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
RAW code
Alternatively, you can write your code directly in PWA.
Simply place your code into a Remote POST action. You can insert any tokens you wish, and the RETURN
from the code will populate the GlobiFlow variable you specified.
Add a new automation step and select "ProcFu Function":
and add your code:
Even better, click on the EDIT
button and access the full BASIC Editor & Debugger:
Please note that token values are inserted by GlobiFlow as-is. In other words, if you're expecting a string in your code, you'd need to put the token in quotes and urldecode
it. For example:
numeric = [(Item) Podio Item ID]
string = urldecode("[(Item Title]")
If you expect a return value, always make sure you use the RETURN
command. Eg:
RETURN "true"
or RETURN x
etc
Note that Citrix Podio Automation requires results as text, so any objects or arrays that your code returns will be JSON encoded.