This example is triggered everytime a Project Task is updated and execute a Workflow from Module “Project” to summarize working hours.

ProjectTask Workflow

The Workflow within Project Tasks looks like this:

Screen1480874922.png


The start action configuration:

Screen1480874993.png

The workflow will only executed, if a Project is set within the Task. (Should be the default case)
Then the “Execute Workflow with external Record” search the Project Record and execute another Workflow, you see below.


Configuration of  execute Workflow with external records:

Screen1480875035.png


Projects Workflow

Screen1480875568-768x263.png


Start condition:

Screen1204192116001-768x448.png


The variable initialization:

Screen1204192157001.png


Summarize all records, which are related to this Project ID.

Screen1204192225001-768x343.png


Set the result into a field

Screen1204192248001-768x168.png

This workflow is not executed automatically. (Start Trigger set to “start manually”)

Because we sum the working hour field about multiple records, we net to initialize the variable and set $env[“hours”] to 0.

The “execute Expression with external Record” execute an small script for every record, which match the the condition. (In this case: Tasks, which are related to the current Project ID)
The script will add the value of $projecttaskhours to the current $env[“hours”] variable.

The last step is to set this value to the Project field “Total Working Time”

Tags: