How can I get a variable "today's date" in String/Date Format for Update Constituent Custom Field

I have created a flow that works when I hard-code a date in the options, but this is going to run daily and it want it to use "today's date". I initially tried utcnow(), but that didn't work, so then I used the let copilot create an expression for you, which gave me formatDateTime(utcNow(), 'yyyy-MM-dd'), but that's not working either.

The error message I'm getting is below. Google was no help in figuring out where this is going wrong. I'm sure it's probably something relatively silly and simple and I'm just a clueless noob. Thank you!

Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'body' validation failed in workflow operation 'Update_a_constituent_custom_field': The parameter with value '"formatDateTime(utcNow(), 'yyyy-MM-dd')"' in path 'body/date' with type/format 'String' is not convertible to type/format 'String/date'.'.

Here is a screenshot of my flow. Again, it works perfectly when I hard-code a date in the Date field.

image.png

Answers

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Kudos 5 Facilitator 4 bbcon 2025 Attendee Badge

    The issue is you "typed" in the expression, which is treated as just a string/text.

    You need to click on the expression icon and type the expression into there (see image below).

    image.png


    Not sure if you should be concern about timezone, but if you do, you can use this expression instead, which convert the UTC time to Eastern Standard Time. (imagine your flow run at 11PM at night, and UTC date would be next day already, but if you convert, it will be "today" in your timezone). Here's the link to see the full list of timezone to convert to (you want the text in the "Timezone" column).

    convertFromUtc(utcNow(), 'Eastern Standard Time', 'yyyy-MM-dd')
    
  • Thank you, @Alex Wong, that was exactly what I was missing. As you likely surmised, I was so close, but copied/pasted the formula that was generated back into that field instead of hitting the 'add" button at the bottom of the function section. I so appreciate your help. I just tested my flow and it's working perfectly now. Also, thank you for the tip on the time zone, I wasn't familiar with that, but added that piece to my formula.

Categories