Retrieve Year as Variable for Enumeration

0
Hello all –   I’m working on a microflow where I need to retrieve the current year as a variable. The data type needs to be an enumeration as that is the field type I have. I have the below but it is not working:   if  parsedatetime([%BeginOfCurrentYear%], 'yyyy']) = '2015' then APPNAME.Enum_Year._2015 else empty   I have tried a couple variations but have not had any luck.   Thanks!  
asked
2 answers
2

 

 

Hi Matt,

For formatting date, you should use below expression.

parseInteger(formatDateTime([%CurrentDateTime%],'yyyy'))

 

So your condition will be like this:

 

if(parseInteger(formatDateTime([%CurrentDateTime%],'yyyy'))=2022)

then APPNAME.Enum_Year._2015 else empty

 

In the above condition, formatDateTime will format the date in yyyy format which will result in string value

 

After that, ParseInteger will convert string to integer for comparison

 

 

ParseDateTime – Used to parse a string and convert to  date in desired format 

 

formatdateTime – Used to convert date to String in desired format

answered
4

Hi Matt,

Use this: If formatDateTime([%BeginofCurrentYear%], ‘yyyy’]=’2015’

 

Hope this helps!

answered