cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Sending email alerts when after 7 days have elapsed on list items

Jump to solution

I have a Form Library for new starters. One of the InfoPath fields is Start Date. What I want to happen is that after seven days has elapsed after the input start date that the initiator gets an email to remind them.

I've set up a Caculate date action as below. dt_Today is a Date and Time variable, dt_NotificationDate is also a Date and Time variable

Calculate date

Next I have a Build String action to format the date and store it in txt_TodaysDate which is a Single line of text

Next I have Query List action. The Coll_IDs variable is a List Item ID variable


Next I have a Loop action.  The CollecetedHRDates is a collection variable, the varCurrTitle is a single line of text variable and idx is a number.

 

This is where I come a cropper. I've got a Collection operation Action

When I run the Workflow and look at the Workflow Progress it carries out the For Each action, but doesn't action the Collection operation and the subsequent Send Notification action.

I've set up two Log in history list actions and I'm getting results for dt_Today, dt_NotificationDate and txt_TodayDate but not Coll_IDs.

Any suggestions on why it's not executing the Collection operation and subsequently not sending the notification?

0 Kudos
Reply
25 Replies
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

so, let's go step by step

Next I have a Build String action to format the date and store it in txt_TodaysDate which is a Single line of text

nothing wrong with this action, however, if you stored result of previous calculate date action as ISO date string to a text variable you would basically get the same output and you might have saved one action.

Next I have Query List action. The Coll_IDs variable is a List Item ID variable

if a variable where you store result set of query list action is of type 'List Item ID' or any other scalar type (single line text, number,...) you will only capture first value returned by the query. all the others will be ignored.

change the type of Coll_IDs variable to collection!

if  you add another list fields to be returned by query list action, each of them have to be stored to a separate collection variable.

Next I have a Loop action.  The CollecetedHRDates is a collection variable, the varCurrTitle is a single line of text variable and idx is a number.

you have used here not initialized, empty collection variable CollecetedHRDates to loop through.

since it is empty the workflow will not step into the loop and no action within the loop will be executed.

you should have used here a collection variable that you previously populated with query list action - ie. Coll_IDs collection variable should have been used in place of CollecetedHRDates 

you have used varCurrTitle variable of type single line text to store current collection element to.

the data type is correct.

the name doesn't play a role from functionality point of view, but since it will hold an item ID retrieved from Coll_IDs collection at current index position (driven by for each loop action), the much more suitable name could be like varCurrID.

This is where I come a cropper. I've got a Collection operation Action

this action is not needed (for the moment). you only query for one single list field (ID) with query list action, so you have only  one collection returned (collection of IDs). For each loop action iterates over this collection and retrieves current collection element value (one item ID) and saves it to text variable as explained above.

for the moment you do not have any other collection variable which you would need to retrieve values from.

you might need the action, if you queried for more then one list field in query list action.

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

Thanks Marian. I think the finish line is almost within sight!

 

I've set up a collection variable called Coll_IDs_2. Happily it's running through the entire Workflow, but is only giving me one alert which is pretty blank, details below:

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

The varrCurrID is a Liste Item ID

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

so you got returned one item from query list action with ID=33 (content of  Coll_IDs_2).

since the collection had one element, one loop iteration was executed and you got notification. so the workflow basically works.

I'm not sure about content of your other variables/references.

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

As Marian already mentioned that your list item id is Coll_IDs_2.

Regarding your other fields - I think you have to check whether this fields into your form is blank or not? If not blank then you have to re-configured the fields into your email body. Also make sure that you have choose proper fields value from library only.

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

Thanks ‌ . I need the workflow to send emails for every item which hits the 7 day elapsed date, but all I'm getting is an alert for Pertwee, and I've entered items with a start date that should trigger an email but all I'm getting is the one for Pertwee.I've logged the Start Date to the history list and had it output to the email and it's giving today's date, surely it should be 13/11/17 ? And shouldn't I be getting alerts for more items eg Ainley?

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

Please post configuration of query list,for each loop and send notification actions that gave you this results.

Post as well value of variable from query list action  (likely txt_TodayDate from above)

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

I ran the workflow and got:

{WorkflowVariable:dt_Today}  01/01/1900 00:00

{WorkflowVariable:dt_NotificationDate} 08/01/1900 00:00

{WorkflowVariable:txt_TodayDate} 1900-01-08

then I ran it again and got:

{WorkflowVariable:dt_Today} 17/11/2017 08:25

{WorkflowVariable:dt_NotificationDate} 24/11/2017 08:25

{WorkflowVariable:txt_TodayDate}  2017-11-24

Here's the configs:

0 Kudos
Reply
Workflow Hero

Re: Sending email alerts when after 7 days have elapsed on list items

Jump to solution

This should have returned an item for Hartnell.

That's only item with StartDate==24/11/2017

0 Kudos
Reply