Solved

How to retrieve "Current Date" daily


Userlevel 5
Badge +13

The use case is this: we have policies which need to be reevaluated periodically. Compliance has asked us to set up a document library that prompts them to reevaluate the policy and send it through the proper approval chan. I've gootten the approval part completed, but now I'm struggling with the reminder portion.

 

They are going to manually set a field called "Next Review Date." On that date, they want an email sent to them letting them know the policy is expired. The catch is that this date can change throughout the year. So if an industry regulation changes in September but the policy wasn't intended to be reviewed until January, they need to change the "Next Review Date" so that they're not reevaluating the policy again in a few months. I was going to use a loop action and have it loop until current date = reminder date but there's no way that I've found that Nintex can get "current date" in O365.

icon

Best answer by jesse_mchargue 27 May 2016, 20:04

View original

16 replies

Badge +7

Hello Courtney,

I don't have O365 Nintex experience, but trying to ans you. If I understand your requirement correctly, you are trying to skip all other items except the ones which you need to evaluate. So instead of looping all elements, can't you use Query List action to filter the items based on your requirement?

One more thought was, if you are running this workflow daily, can you create a workflow variable of type date and time, then you can choose default value for the variable as today's date?

Userlevel 5
Badge +13

Unfortunately, O365 does not give a "today" when you choose a date in any of the evaluation fields. You can use "date executed," but if it's not executed daily, then it doesn't update.

The only reason I need it to evaluate daily to retrieve the new current date is in case the "Next Review Date" is changed by users. If I just use a "Pause Until" action, it will pause until the first date that was entered regardless of any later changes made by users.

Userlevel 6
Badge +12

Hello Courtney Shelton​ -

I would not use Pause until for this. You do not want a workflow hanging for months at a time!

You could create a site workflow the queries the list and creates a collection of items where NextReviewDate = varToday

You can leverage the 'Use date when action is executed' since your site workflow will run everyday.

Try creating a workflow variable called varToday and create a Set variable action.

Next, in your query list action, you can filter the items down to where NextReviewDate = varToday.

Let me know how this works out or you have any questions!

Hope this helps!

Userlevel 5
Badge +13

Office 365 does not do site workflows, unfortunately. I don't much care for the "Pause Until" being paused for months/year(s) at a time either, but I can't find a better way to do it in the 365 constraints.

Badge +7

Hi,

O365 does have site workflows but you'll need to access them from Site Contents - Nintex Workflow for Office 365 app.

Jan

Userlevel 5
Badge +13

Oh wow! TIL on that one, is this a newer feature? I thought I recalled clicking that going to the App Store for some reason.

Userlevel 5
Badge +13

So once they're filtered, how do I send the notification email on the ones that need it?

Badge +3

Option1: Use Calculate Date Date Action and check the chek box for current date.

Option 2: Bulid String in common section select Current Date.

Userlevel 5
Badge +13

I've already said that Nintex Workflow for O365 does not allow you to access/check/see "Current Date" else I wouldn't have posed this question.

Userlevel 6
Badge +12

Hello Courtney Shelton​ -

You will need to store your queried data in collection variables and then using a For Each action, loop through the items.

I was planning on writing a blog about this topic as I have seen a few questions around Query list and For each actions and how to iterate through the resulting data. Until I publish the blog, check out How do you send one email for multiple list items . I helped David Busch with similar requirements and approached it the same way (query list > store collection variables > use For each loop to get each item > send email). The main thing to keep in mind is that for the example, we created ONE email. It sounds like you want to send one email per item (if that is correct, you will want to have the email in the loop, not outside of it), so keep a close eye on how to set up your loop.

I will post my blog soon (kids willing ) and post a link to it here.

Hope this helps!

Userlevel 5
Badge +13

Ok, I've set up a query, then the forEach loop with an email in it and an email after it to see what kind of different behavior we get! Thanks for all the tips.

Userlevel 5
Badge +13

Jesse McHargue​ figured it correctly! Basically I set up the workflow as such:

I used the "Set Time Portion of Date Time Field" to set the variable todaysDate to the Date the Action was executed with 0 for the hour and minute (to set it with no time). Then ran a "Query List" where Next Review Date = todaysDate. Then a For Each loop which changed the status of the  item to "Expired" which triggers my list-specific reminder workflow which generates emails.

Userlevel 5
Badge +13

So the issue with using a site workflow is that we're unable to schedule it without implementing an additional external solution such as Plumsail or Azure. Any ideas other than having a list workflow trigger the site workflow? Then we're back to relying on the list workflow to loop and trigger the site one, in which case, there's almost no need to even have the site one.

Badge +9

Hi

I have a similar requirement on a multi state Policy approval workflow, which has a couple of pauses in each state.  Like you I want to retrieve the current date so as to compare with the various dates in the current state.  I have found you have to be careful when setting dateWhenWorkflowAction  beause if there  delays between states, today maybe yesterday!  Added to the need to constantly add hours to certain key dates given no executive  needs a reminder at 01:00 in the morning 😞 , It will be glad to see the back of it.

Daniel

Userlevel 5
Badge +13

Hey Daniel,

Can you give me a bit more info on your requirement? It sounds like a site workflow would be great for you, and possibly breaking your workflow into chunks (one WF per approval person or approval group). 

We have a requirement for a reminder to be sent out for someone when a task due date is approaching. We were using the "Pause Until" block, but then if the user changed the due date, the Workflow would be suspended and thus not pick up the change. So, we created a site workflow that runs daily and looks for ones where [due date - 7] == today (they want the reminder seven days before the due date). So, since it's checking the due date daily, no problems with the change in date! And we scheduled the WF for ~7am. 

We also have a requirement for a linear approval, like you. For that one, we have a separate workflow per group (one for SVPs, one for Executives, etc). Our users wanted to intervene between each stage (between SVPs to Executives) to see what changes were made by the previous group. So, there are dropdowns "Ready for [group] Approval" and on modified, the site WF checks to see if that is "Yes" and if so, it goes through the WF for that group. 

Badge +9

Courtney

Thanks for reply. Sorry I took too long to reply but I was on a roll on Friday fixing bugs 😉.  I read your post with interest  esp with the changed due date causing the w/f to hang - I will be checking to see if this might happen when I next see my client on Tuesday. Thanks for he heads up here.  Looks like we have very similar requirements.

In my case I drive the date for reminders and approvers through the dates of certain meetings in the team calendar.  These are identifiable by specific categories. I use ( set variable) lookups that query the category to determine representatives ( approvers) and admins , who distribute the papers requiring approval. The categories from the outset are really check box options in the edit form, entered when adding a new document. My tip, is to build a generic state with an Approval task and set it's identity: Executive, HR Committee etc as well as the various participants,  in previous navigational state.  I found this avoids the W/f becoming too big and duplicating States that all look similar. 

You are right deploying a site w/f  to assist the list workflow. For various reasons I am building a SPD Site workflow that checks dates - 4 months daily for on each of the documents.  

Regards

Daniel

Reply