Hello. I'm building an approval flow that is triggered when a file is added to a library.
There are a number of columns in the library which are required including the approver. Obviously, these are not populated when the flow triggers. Therefore I have added a 'do until' that gets the file properties until the approver has been selected.
I had this working okay when testing with a single field (approver) with the test condition (not empty) directly in the do until. But it suddenly stopped working in the last 3-5 days. Therefore, I started testing with some of the other required fields. Including using a variable in the Do Until condition and changing this within the Do Until using a condition.
In virtually all cases I get this 'InvalidTemplate' error either directly in the Do Until condition or the separate condition within the Do Until that tests the empty/null/blank fields:
If this is correct, then why do the columns appear as available when building the flow?
Interestingly, in my most recent flow, the remaining steps in the flow execute correctly despite this error. As you can see here:
For reference, here is my flow:
The ID used in 'Get file properties' is from the 'When a file is created' step (triggerBody()?['ID']).
The InvoiceAmount used in the 'Condition' step is from the 'Get file properties' step.
I'm now going to create a new library and try again. Because while it seems to be working, I'm not confident that there is some underlying issue. Or perhaps I'm betraying my lack of knowledge! Happy to be educated. :)
While I don't really understand why, I think that I've at least got a workaround for my template error problem.
It seems that 'Get file properties' action and 'When a file is created (properties only)' trigger do not output columns that have no data in them. Except if the column is a person/group column.
For example, when initially constructing my flow, my condition step only tested whether the 'Approver' column was empty. My flow worked because the 'Approver' column is output by the 'When a file is created' trigger and the 'Get file properties' action even though it is blank/empty. However, when I put my 'InvoiceAmount', 'InvoiceFrom' or 'InvoiceDate' columns in the condition, I get the TemplateError because the columns are not available in the output of 'Get file properties' action. But when I put a default value in the 'InvoiceAmount' etc. columns, they appear in the 'Get file properties' action output and I don't see the TemplateError.
This is not desired behaviour as I would like the person adding an invoice to be prompted for the required fields before the invoice is sent for approval. However, I can workaround by assigning default non-sensible values to the columns. Then test these in my condition and only send the invoice for approval once the columns have different values. Which are hopefully more sensible values.
I'm probably still bit of a noob at this stuff :) but I'm learning. Is there a way to test if the column exists in the output before testing the value? Is this what the 'coalesce' function is for?