Setting conditions incorrectly?

  • 28 August 2017
  • 3 replies
  • 6 views

Badge +1

I have fields named "When will item be returned?" and "Date Returned". The "When will item be returned?" field is chosen by the initiator when the item is created. The "Date Returned" field is set when the material has been confirmed returned.

Now if the material has not been returned by "When will item be returned?", then I want an e-mail to be sent to the initiator, and another member, stating that it has not been returned and to ask where it is at.

I can't seem to figure out how to do this. I've tried setting a condition within my workflow involving "When will item be returned?" and "Date Returned", but since the date returned field is always empty until it has in fact been returned, I don't think I can use it with my condition.

If anyone has any idea what I am talking about, any kind of help would be appreciated. I feel like I'm running around in circles trying to make this work.

Thank you!


3 replies

Userlevel 5
Badge +13

So basically, you want a site workflow that checks for "date item will be returned" has passed and "date item was returned" is effectively null, right? So, in SharePoint, date fields are never "empty," a null date is 1/1/0001 12:00:00 AM

So, you can have a site workflow run daily and check for today > dateToReturn && dateReturned == 1/1/0001 12:00:00AM does that make sense?

I would actually have that workflow query the list for those that meet the filter, and then have the actual notification workflow be on your list and have your site workflow start your list workflow. Let me know if you need more details!

Badge +1

This is only a small part of a list workflow that I am creating, which is a sort of material withdrawal form. It appears that everything is working as I want it to, except for this segment.

I want if "When will material be returned?" date has passed, and "Date Returned" field hasn't been set (triggered once the item has been returned), to then send a notification e-mail. I can't seem to figure out how to do this, because the actions can't really be run parallel. I'm sorry, I'm having a tough time understanding and also explaining myself, I've been stuck on this.

This workflow will only apply to one list. If you could explain with a little more detail how I might solve my issue, I would really appreciate it! Thank you very much for your help so far!

Userlevel 5
Badge +13

Hey DJ, have you made site workflows before? Basically, I'm recommending that you move your reminder piece outside of your existing workflow and make a site workflow that you schedule to run daily. So this site workflow would look something like this:

207091_pastedImage_1.png

For getting "todaysDate" I like to use the "set time portion of date/time variable" action and set it to be midnight. For some things, it matters about the time. You can also just use the "set variable" action if you don't care about the time it registers. 

207122_pastedImage_2.png

Then we query the list for items where the return date is in the past and the "date returned" is 1/1/0001 12:00:00AM (since we know that means it's null).

207125_pastedImage_114.png

Now for each of those items, we'll do something. In this case, start a list workflow that has our reminder email and info in it. If you'd rather, you can do the generate email inside this site workflow. I'll show that after this.

207124_pastedImage_4.png

So for each item in "collID" which is our collection of IDs that meet our criteria above, we're going to do something. The "output value" is going to basically output the ID of the item we're on in the collection.

Now we have two options, first, we can start a list workflow that does our email and such for us:

207126_pastedImage_115.png

Or, instead, we can just send the email from here. To insert things, you'll use the "list lookup" advanced entry, like this:

207127_pastedImage_116.png

(for the "Field," just pick whatever your list is using as the person who requested the item).

Let me know if you have more questions!

EDIT: I edited to mention, if you schedule this to run every day, then each day something is not returned there will be an email sent until they enter the date. For example, if they say they will return the item on Monday, this workflow will run on Tuesday and send an email, and when it runs again on Wednesday, if they still haven't entered a "actually returned date," it will email them again, and so on until they put a value in that field. If you want this behavior, congrats! If not, you can set a hidden column that's somewhat of a "flag" like reminderSent and have whatever workflow actually sends the email set that value to "yes" or "true," then add an additional critera in your queryList action that looks for && reminderSent != yes or what have you.

Reply