Forum Discussion

Ian Macnaughtan's avatar
Ian Macnaughtan
Brass Contributor
Mar 25, 2018
Solved

Do Until - Get File Properties ... Invalid Template ...

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 ar...
  • Ian Macnaughtan's avatar
    Mar 27, 2018

    I think i've solved it and discovered that this is what coalesce is for. Here is my working Do Until condition without needing to assign default values to the columns in the library:

     

    @and(not(empty(body('Get_file_properties')?['Approver'])),not(equals(coalesce(body('Get_file_properties')?['InvoiceAmountExclGST'], '0'), '0')),not(equals(coalesce(body('Get_file_properties')?['InvoiceDate'], '19000101'), '19000101')),not(equals(coalesce(body('Get_file_properties')?['InvoiceFrom'], 'Nobody'), 'Nobody')),not(equals(coalesce(body('Get_file_properties')?['InvoiceNumber'], '0'), '0')))

    If i understand coalesce correctly, the fallback value could be any string value. I just chose values that kind of made sense for the type of each column.
     
    The Do Until > Get file properties loop now keeps looping until all the required fields are populated. Without generating the InvalidTemplate error.
     
    I'll mark this as solved and hope someone finds this useful.
     
    Ian.

Resources