Creating new tasks: Workflow To Task

Modified on Wed, 20 May, 2020 at 9:40 AM

Introduction

I have designed a workflow to call a web service and return the city description based on the city name received. I would like now to encapsulate this workflow named CityDescription as a new task and use it like any other task in my workflows like hereafter.

 

 

To build my workflow, I’ve been using a free webservice available at rescountries.eu.

 

http://restcountries.eu/rest/v2/capital/{cityname}

 

 

If there is no error, we will extract the data from the response using this small evaluated script:

 

gc.city_result = {}
gc.city_result['city'] = city
gc.city_result['population'] = response[0]["population"]
gc.city_result['country'] = response[0]["nativeName"]
gc.city_result['countrycode'] = response[0]["alpha2Code"]
gc.city_result['borders'] = response[0]["borders"]
gc.status_code = status_code


This workflow will return an object city_result containing several informations: population, native name, alpha code and country borders.


Please note that, variables returned by your script should be defined in the global context.

 

Creating my task

To build that workflow task, you need create your workflow, to save it and to click on the array on the right of the save button, and select the “Workflow to Task” item

 

Workflow to Task command

 

You will be presented this following dialog. 

Workflow to task dialog

 

 

“Main” tab lets you name your task, place it into a category, define how many ports you need, …

 

The “requires” area let you define external lib you may need to execute your workflow.

 

“Input fields” tab let you define the parameters you may pass to your new task. It works like a form. Just drag the type of value from the lower area into the upper area. 

 

String, Number, … are static parameters. 

If you need a variable parameter, select Evaluated.

 

In our case, we’ll be dragging an evaluated field and we will name it “city”.

 

When you are finished, click on the Create Task button and your task is now ready to be used.

 

 

 

Using our Workflow Task

I’ve designed a small sequence in which I will enter a city name as first step, then execute a workflow call my newly created task, and finally display the city description information.

 

 

 

The “Enter city” form as only one field named “city”

 

 

 

My workflow is very simple and basically call CityDescription task passing the entered city name as a parameter.

 

 

 

 

The display result form is pretty simple too. In order to display the object city_result, I’ve added a Grouped Field (named city_result) and I’ve added sub-fields inside this group.

 

 



Editing my Workflow Task

And what if I changed my CityDescription task? How will it be reflected on workflows using this task?

 

If you’ve made some modification in your workflow, double-click in the CityDescription task list and you should get this dialog with the bottom line of buttons.

 

Message “Task out of sync” means that your modifications has not been taken into account yet. 

 

 

Click on the button Rebuild, to update your CityDescription task with your new version. Green message should now display the message “Task is synced with workflow”.

 

 

Other Actions

Delete

  • Delete the workflow task from your system.

 

Export

  • Export the workflow task as a file. You’ll be able to import it in another system.

 

 

Source

  • Will open the source workflow. This will work only on the server which created to Workflow task.

 

Embedded

  • Open a copy of the current Workflow task. You won’t be able to edit and resave it as a new version. 

 

 

Sharing your task with another server

You can manage your task from the Workflow/tasks menu item. It will show you all the known user defined tasks. 

 

Select your CityDescription and click the export button to export it to a file that you will be able to import on another Pulse-IT or Automate-IT server.

 

 

 

Note: If you import a Workflow task to another server, you won’t be able to edit its content.  

 



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article