Calculate values from external records in vtiger could be a usefull feature to aggregate values related to one records.
In example you should want to sum all Sales Order of current year and have the result in one organization field. With workflow designer is easy to get this result.
You have to create a workflow in Organization module like following:
This is basically the workflow you need, with 2 blocks.
In first block you can calculate value(s) you need:
I.e. in this case we save in environmental variable $env[“pre_tax_total_sum”] the sum of Pre TAx Total field. The sum will consider all records where organization set in Sales Order is the organization we are doing WF and created time is in current year.
Following step is to set the value we have calculated in block set values as following:
After workflow is load than the custom field Sales order this year will be filled.
You can trigger workflow in 2 ways:
1 – schedule workflow in workflow planner
2 – launch workflow as external workflow every time a sales order is saved.