I currently have a workflow where I need to get the current day of the week (Mon,Tue,Wed etc), so that I am able to add the correct amount of business days before the workflow auto approves.
I was previously using an API to retrieve this, but it seems that API stopped working. I would prefer to use an in house Nintex function, and wondered if this was possible?
Thanks for your help!
Solved! Go to Solution.
Hi @butlerj , thanks for replying!
I am trying to get this data within the workflow.
I get the day of the week, previously using the API, and then depending which day of the week it is, add on days for the auto approval process. The DueDate is sent to another workflow.
@JimOw Yeah so you can do this with a combination of two actions within your workflow. The first action will be the Format date to string action, and you will use the following configuration to get the current date (from your Context variables) with the day name:
After that you can use the Regular expression action to then parse off just the name of the day into it's own variable with the following configuration:
I used the following regex expression, but you might be able to come up with something better: ^([^,]*)
Hope that helps!
As it is Monday (day 2 of the week) I’ll post my two pennies to this. I used the nice external Azure function as described by Sean Fiene (link) and that worked fine for a while until I got some 500 errors suddenly. For a native solution you can use of course the always genius solution of ButlerJ above. But as I am not good with regular expressions I thought I just share how to simply calculate it.
My use case was for a scheduled workflow that must run every weekday. Uh… but the schedule in the NWC start event cannot do this (yet). Only every day, every week, every month.
OK then I’ll just quit the workflow on Saturdays and Sundays. But how?
The main idea is simple: We calculate the amount of days between the input date and 31 dec. 1899. (They say that was a Saturday). Take that amount of days modulo 7 and you will get a number between 0 and 6. Zero being a Saturday (correct that to a 7) and Sunday as 1, Monday as 2 etc.
Using an integer variable for the divide and multiply simulates the MOD function.
This generic function takes a given date as input and returns the number of the day of the week as well as the text value in English.
Wrapped in a nice component workflow you get this:
If anyone wants to import this workflow as-is, just drop a reply and will post a fresh export key. Nintex makes those keys only valid for 3 days (!) but I am happy to post a new one whenever somebody asks.
The key for Feb 15 - Feb 18, 2021 is this.