How do I create a custom workflow library?

Note: This is a beta feature.  

Sometimes it's useful to create a custom workflow library that can be called by your workflow.  This is useful if you want to store common functions or variables.

Here's how you can create and use a custom workflow library.

Step 1: Log In Your Medium One platform account

Step 2: Create A Custom Workflow Library

Navigate to this URL directly: https://app.mediumone.com/#/workflowlibraries

Click on Create New Library

Screen_Shot_2020-06-18_at_11.00.27_AM.png

Create a library:

- Set library name to Env

- Create function getVar() using example below and click Save

def getVar(var):
if var == "env":
return "staging"

Screen_Shot_2020-06-18_at_11.02.55_AM.png

You should see the new library like so:

Screen_Shot_2020-06-18_at_11.03.13_AM.png

 

Step 3: Call Workflow Library from a Workflow

Refer to the following example to call the workflow library. 

from my import Env
log(Env.getVar("env")) # print out value from Env.getVar("env")

Screen_Shot_2020-06-18_at_11.05.44_AM.png