Blog: Workflow Arithmetic
By: Angela Lindsey
In my experience, digital content workflow has been one step forward and one step back with an occasional jump. A recent project I worked on brought a new twist to workflow that was both challenging and fun. The client required items with a value of over 10 million annually to route one way for additional approvals, and all of the others to follow a less restrictive path. An easy way for the developer to do this might be to create a metadata field with that number (i.e. xTotalAnnualValue) and have the client populate it. However, that requires additional data entry on the client side; plus, in this case, the client didn’t have this value predetermined, so some calculations would be required as well to define the value. Wouldn’t it be nice if we could save the client the burden of this extra work by performing the calculations within the UCM workflow process instead? We can. Yes, Mr. Customer: This UCM software you have purchased can perform arithmetic, algebra and analysis on the backend and us developers can make this all seamless for you by configuring an algorithm within the workflow steps.
In this case, I had the following to work with: Total Contract Value and Contract Term. To achieve the goal, I had to use the wfSet, wfGet, and toInteger functions and then use a conditional statement to decide where the content item routes.
I set up a variable for each of the metadata fields in the workflow using the wfSet function. This will bring in the value of the metadata field for calculations against it.
Before starting the calculation, it was discovered that these fields were not set as integer in configuration manager, so we had special characters included in our variables (i.e. $15,000,000.00). To resolve this issue, the toInteger function was used.
Simply dividing the total contract value with the contract term only gave us the monthly value of the contract, so we needed to make another temporary variable to store the monthly value first. Again, the wfSet function was used to create and set a variable, but now the wfGet function was also needed to get the value of the above variables. Using a combination of the wfSet and wfGet achieved this.
Finally, taking the MonthlyValue and multiplying by 12 would give us our TotalAnnualValue. To get this, a combination of wfSet and wfGet are used again.
The conditional statement can then be used with the wfGet to evaluate how much the TotalAnnualValue is and route accordingly.
<$if wfGet(“TotalAnnualValue”) > 10000000$>
Using math in a workflow may come in handy sometimes and can save the client some work by dynamically routing content based on other metadata values that satisfy the business process. Your algorithm may be different, but, rest assured, there is likely a way to calculate it and route it appropriately. Hopefully this is a good starting point.