04-06-2022 02:45 PM
is there a way to get the "AddMonths" expression to recognize what month it is and actually add the correct number of days? trying to get this to fire on last day of month and then update a KW in a Unity form to reflect the next due date (last day of next month) but it just adds 30 days 😞 see image...should be 7/31/22. every month WF will send out a reminder based off date in Unity form and then it needs to update that KW in the form to the next month and wait til timer fires again
04-07-2022 06:26 AM
I recommend an expression closer to this:
AddDays(AddMonths(AddDays(%VPropDate;1-Day(%VPropDate));2);-1)
You could replace the %VPropDate with Now(), but this expression preserves the time component of the date, so you'll get the last day of next month at the current time (plus or minus an hour if there's a DST transition one direction or another between the current date and the last day of next month). If you don't want that, I recommend keeping %VPropDate and adding a Set Property to Expression that sets %VPropDate to this:
Date(Year(Now());Month(Now());Day(Now()))
And then put that Set Property to Expression right before the Set Property to Expression action that calculates the last day of next month. You could technically put it all into one big expression:
AddDays(AddMonths(AddDays(Date(Year(Now());Month(Now());Day(Now()));1-Day(Date(Year(Now());Month(Now());Day(Now()))));2);-1)
But I consider that near impossible to read. If you split it into two steps, you can name them something clear like "Put current date into %VPropDate" and "Calculate Last day of Month after %VPropDate" which is easier to understand when you look at the workflow later!
04-07-2022 06:41 AM
Thanks for both answers. this is a bit overwhelming as i'm new to this Expression thing and it's pretty complex to do something seemingly easy!
04-07-2022 08:51 AM
Making progress, I must be missing something. I setup both Expressions and they appear to work correctly but the KW isnt updating. any ideas?
this is what I'm doing...can ignore first two Actions :
04-07-2022 08:58 AM
Looks like you ought to be close. I would check:
1. Property names match exactly (sometimes a space at the end will be an issue)
2. Property bags match between actions (both use session, both use scoped or both use persistent)
3. Data type on the keyword. If it's a date data type, you might need to take an extra step to format the property output as just the date, where you can see in the expression tester it's giving a date/time result.
If you use on demand diagnostics in the Unity client (file > troubleshooting) and set the workflow level to debug, that should walk through all the steps it's taking and shed some light on the issue.
04-07-2022 10:11 AM
@Larissa Armand thank you so much 🙂 going to work through your suggestions
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.