Forum Discussion

Gilbert Okello's avatar
Gilbert Okello
Iron Contributor
Aug 07, 2016
Solved

Issue with creating DateTime Condition in Microsoft Flow

I am trying to create a recurring Flow which checks the difference between a date field [ContractEndDate] and variation from todays date.

 

If ContractEndDate is less than (todays date + 15 days)

 

Looking at the workflow definition language here (https://msdn.microsoft.com/library/azure/mt643789.aspx) i came up with the following logic:

 

@less(item()['ContractEndDate'], adddays(utcnow('yyyy-mm-dd'),15)

 

If I remove the 'adddays' function, it works. 

 

Any ideas?

 

Merwan Hade

  • The adddays function returns a string (iso date format), but the first part of your less function contains a date format that has not been formatted yet, so I suspect that the string compare does not give a proper result.
    You should format the ContractEndDate to the same string format as the calculated date to have the Less function work as expected.

7 Replies

  • Anonymous's avatar
    Anonymous
    hi Mike / Gilbert Hi Dear I am writing the following to a SharePoint column but it is not getting successful, the condition is not going to YES. @equals(string(item()['Contract_x0020_End_x0020_Date']), adddays(utcNow(), 20)) if you can guide, where is the mistake thanks in Advance
  • The adddays function returns a string (iso date format), but the first part of your less function contains a date format that has not been formatted yet, so I suspect that the string compare does not give a proper result.
    You should format the ContractEndDate to the same string format as the calculated date to have the Less function work as expected.

    • Gilbert Okello's avatar
      Gilbert Okello
      Iron Contributor

      Thanks Mike Platvoet.  That worked!! 

      I converted the date into string as follows:

      less(string(item()['ContractEndDate']), adddays(utcnow(), 15))

      • Anonymous's avatar
        Anonymous

        Hi Dear

         

        I am writing the following to a SharePoint column but it is not getting successful, the condition is not going to YES. 

         

        @equals(string(item()['Contract_x0020_End_x0020_Date']), adddays(utcNow(), 20))

         

        if you can guide, where is the mistake thanks in Advance

Resources