Hello,
I'm trying to set up a check condition to compare a date field on a Dynamics record, to see if that date is greater than or outside of the current year. I haven't seen any posts quite like this, many reviewing comparing a date to the current date or a date with an added duration (10 days).
This kind of comparison can be done OOB in an Advanced Find in Dynamics, so I'm thinking a check condition can be created for a variable time frame (current year). Any insights will be greatly appreciated!
Best,
414-365
Solved! Go to Solution.
Sorry my mistake, ticks is not necessary when we just talk about the years. You have to add it with the expression also the data verse variable:
For the Dataverse Variable, instead of utcNow() insert via the Dynamic Data Tab your Variable from Dataverse.
You can immediately work with the data verse Variable, if you facing issues with the format you can store it in an integer Variable right before.
I wasn't seeing errors due to blank field values, but that is helpful! What I ended up needing to do was take my date column and initializing it as a string value formatted using formateDateTime:
Then comparing that with formatDateTime(utcNow(),'yyyy') worked without any errors. Thanks again for all of your help!
So you search for the current year ?
You can try that expression to get the current year:
formatDateTime(utcNow(),'yyyy')
If you want to compare the year of your Dataverse Date and current year you can compare ticks(formatDateTime(DataverseRecord,'yyyy')) is greater than ticks(formatDateTime(utcNow(),'yyyy')).
Thank you for the help! Do I need to take the DataverseRecord and establish the variable prior to the comparison? Below is what I attempted but am unable to insert the DataverseRecord:
Sorry my mistake, ticks is not necessary when we just talk about the years. You have to add it with the expression also the data verse variable:
For the Dataverse Variable, instead of utcNow() insert via the Dynamic Data Tab your Variable from Dataverse.
You can immediately work with the data verse Variable, if you facing issues with the format you can store it in an integer Variable right before.
Ah that makes sense. Here's what I'm using for the check:
Are you using DataverseVariable or did you just replaced it with DataverseVariable?
You need to select your special Date Field
looks like:
1. Click into the the Condition
2. Select Expression in the pop up
3. Type in formatDateTime(,'yyyy')
4. Insert your cursor right before the comma formatDateTime(Here,'yyyy')
5. Click on Dynamic Data Tab and search for your field and click it
I'm replacing the column name with DataverseVariable. I attempted to follow your steps and am now getting a different error. Previously I was only using a Trigger to pull in the column, where I've now added the "Get a row by ID" step:
This is the full expression with the column replaced by Database_Variable:
I tested it by myself and was facing the same error. After some investigation I found that the data (Date) sometimes is empty because this was not a mandatory field. Maybe some entries don't have a value for your date field as well.
You can check this also in you condition if the value is empty, then this entry will be skipped.
You can use empty()
I wasn't seeing errors due to blank field values, but that is helpful! What I ended up needing to do was take my date column and initializing it as a string value formatted using formateDateTime:
Then comparing that with formatDateTime(utcNow(),'yyyy') worked without any errors. Thanks again for all of your help!
User | Count |
---|---|
87 | |
43 | |
21 | |
18 | |
16 |
User | Count |
---|---|
132 | |
47 | |
42 | |
36 | |
28 |