In tip 1199, Leon Tribe talked about the power of using variables in Microsoft Flow. Leon astutely pointed out that using variables can simplify process development by allowing reuse of values between steps in Flow, and they can also be used for calculation purposes and building strings.
One challenge with working with integer type variables in Flow from a CDS/Dynamics 365 perspective is that you cannot directly write the value from an integer variable into a Dynamics 365 field.
Recently I created a Flow to calculate a contact score based on data quality–more about this in a future tip. As part of this flow, I created an integer variable called “score” to be used to calculate the data quality score.
At the end of the Flow when I wanted to update the contact with the data quality score, I tried the three types of number fields in Dynamics 365/CDS–whole number, floating point, and decimal. The variable was being calculated, but I could not get the flow to update any standard number field (or text field) with the value of the integer variable.
The solution was to use the int() transformation expression. By using the expression int(variables(‘score’)), I was able to update a decimal number field in Dynamics 365 with the value of my integer variable.