Getting Started Guide
Learn the Basics
Create a Python Integration Task
7 min
one of the most powerful features in swimlane is the ability to kick off an automation task in this section you will create a simple python task that you'll be able to launch via the click of a button and automatically you will not only kick it off, but also pass a value from your record into the script, manipulate it, then pass the results back to your record the task you create will receive an input from a field in a record modify a variable of that field output the modified variable back to a record create a task to create a python integration task from the global navigation menu in swimlane select integrations from the integrations taskbar, click the plus menu icon, or new task , and then select create a task when you create a new task, you need to specify the assets the task will use filter for python and locate the python 3 6 plugin action next, click create at the end of the python 3 6 plugin action to begin creating the task name your new task, and then associate it to your new application on create a task, click save you now have a python task associated to your application the task opens with the general tab enter a description on this tab, if you'd like, then click configuration in the next sub task, you'll specify the code and the field inputs for your python integration task configure and map inputs to the task on configuration, enter the following python code my input var = sw context inputs\['text'] my input var = my input var + " is the best" sw outputs = \[{'output' my input var}] next, you set up swimlane to grab the value of the text (2) field when the task runs you do this by specifying an input mapping below the configuration window, under inputs, click add parameter, then add the values shown here click save next, you map a value from your python script back to a swimlane record, also known as creating an output mapping map the outputs from the task click the outputs tab for this exercise, you'll be creating output mapping to update a current record click update current record if you're interested in learning more about other ways to map output, see configure task output docid\ ocwbk73t 1mq2bihofc5p on the next screen, which asks you, "how would you like to proceed?" select map to existing fields click through the next screen, which provides you with introduction to mapping on update current record for your new application, note that multiple fields have been identified as potential parameters for this exercise, you don't need to map those parameters, but instead to create a new one place your cursor in the text field preceded by the words add new output mapping for and type "output" then click the adjacent plus ( + ) sign the output parameter is now available above you need to map the parameter to a field, so from the app field / field type pull down, select description click add mappings to app on approve field creation and mappings, review the mapping, and then click approve from the integration task bar, click save next you'll set a trigger that will make the task run set a trigger for the task there are three ways to set triggers in swimlane trigger type sub type definition automatic scheduled the trigger is scheduled, like a cron job you specify how often the trigger is activated minutely, hourly, daily, etc this method is most commonly used when a task is collecting records from a database, slack channel, or email inbox, for example email the trigger is activated upon email receipt record save the trigger is activated when a record is saved workflow the trigger is activated automatically when built into the workflow stages and actions manual the trigger is activated when the user manually pushes a button for this exercise, we are creating a manual trigger to set a trigger for the task click the triggers tab click the triggers, manual tab, then click open application builder application builder opens your application, where you will associate the python task to the application select the integration field in the application form layout, then access the app settings on app settings, access the task dropdown and select your python task, then click save on app settings, you can also specify the size of the integration button in a record the example here is 100% now you're ready to test your automation related links configure task input docid\ a18jba9dkqbggtr8d4kjg configure task output docid\ ocwbk73t 1mq2bihofc5p create or edit a task docid\ ryxk0zn8kfyu4nr zkwjm create or edit a task docid\ ryxk0zn8kfyu4nr zkwjm workflow docid\ v7bf y4fxu5ba5sf2hiqy