Query List


Badge +7

I created a scheduled site workflow for a list. That will send a notification in 90 days from the effective date.

  • Action set
    • Calculated date (90 days ago)
    • Query list
      • Filtered by effective date which equals my variable
      • Type of action "new"
      • Status "Employee
    • For each
      • Email notification
  • So the workflow looks at the effective date, status and type of action
  • I need to also add logic that says if the employee has been type of action "Termed"  within the 90 days then do not send the notification

Help? Do i add another query list within the for each?


23 replies

Badge +11

Hi D M

If the current value of the Field "Type of action" is "New" and it was changed from "Termed", then you cannot filter them. You cannot filter based on the previous value of the same field.

As an alternative, you can trigger a calculation or another workflow when the employee is "Termed". Save that date in a field. Then you can filter if this date field is within past 90 days which will be greater than your effective date that was 90 days ago. Hope that helps.

Badge +7

hi ‌ Thank you for your response. It would be a new item with the individual name "Type of Action" Termed within the 90 day period. Any idea How i can say don't send the notification if the employee name shows up again in the list within these 90 days with the action type as termed.

Badge +11

Could you please post a screen shot of your data? If you have multiple employee name items in the list and you are already eliminating them with filter condition in the Query action, how are they going to show up in the collection?

Badge +7

in the query list:

Badge +11

In the Query action, create a collection of the ID's and not the employee names. So you will get ID's for those that are type of action New. You can get the employee names for each of the ID's using collection operation. Create For-Each loop with ID collection.

Badge +7

Ok I will change the employee name to ID. Where do I put the collection operation before the for each? How do I set that one up? I've never used it. Also, how will it ok now if the same employee was terminated (if a new item is added with employee name and termination type within the 90 days)?

Badge +11

This is why I had asked you to post the screen shot of the data. I'm again confused on the way you are saving data in the list. Could you show me screen shot of your list with individual rows of data and have New and Termed as type of action for same employee?

Badge +7

Terminations

So now if termination was listed in the new hire (first screenshot) as well. I would not want a notification sent. on the New hire item. So someone I need to have logic to say, if a new entry with the same individual name is entered and with type of action Termination then do not send the email (on the site workflow).

Badge +16

Inside your for each you would query the terminations list where individuals name = individual name in current item in loop.  Then have a run if action to check if name not returned (I,e, not in both lists) and inside that have a send notification.

i can mock this up for you if the answer doesn't make any sense.

Badge +7

could you please mock up something for me? Thank you so much!!!

Badge +16

OK here is what i have done:

Calculated date (90 days ago)

  • Query list
    • Filtered by effective date which equals my variable
    • Type of action "new hire"
    • Status "Employee"
    • Bring back ID of records that meet the criteria into a collection of IDs
  • For each ID in the collection of IDs
    • Query the list again to get the individual name (where ID = ID in collection)
    • Query the list again (where individual name = above name and type = "Termination") - output the ID of the result into a variable
    • Create a null variable
    • Run if output ID = null variable (i.e. no records with termination) 
      • Email notification

Here is the workflow.

Badge +16

Can't seem to attach the workflow for you - I will send it in a private message.

Badge +7

Cassy,

Thank you so much for everything! I will try it now.

Badge +7

hi Cassy,

in the query list within the for each when you say get the individual name am I selecting the field Individual name in the Sort section and add it to the vTextIndividualName variable? or am I filtering anything? (I am keeping it not filtered). I have the same question with he second query.

Badge +7

sorry for all the questions!! I've only used the query list a few times.

Badge +16

I emailed the entire workflow solution to your email address on your profile - did you get it?

Badge +7

The query lists were empty sad.png

Badge +16

Send me your configuration for the actions. I'm away now until Monday but I will look then

Badge +7

Hi Cassy,

Again thank you very much for your help with this.

the second query list:

The third query list:

So if I am employee a is hired on 10/1/16 that would be one line on the list (one item) and if the same employee is fired it would be a brand new item on the list (not the same).

Let me know if this makes sense.


Thank you!!!

Badge +11

The second Query should have a filter. Where ID = varEachID from the previous collection of ID's in For-Each loop.

You may not have to create the second query action and replace that with Set Variable action. Set the varEmployeeName using ListLookup, get the Employee Name where ID = EachId from For-Each.

Badge +11

 , Do you have any updates on this? I hope the workflow is working as expected.

Badge +7

thank you for checking in Kapil. I've updated the workflow but it seems like I do not receive notifications on all items now that fit the correct criteria (new hire) effective date 90 days that have not been termed (another record). It seems to pick up only the first item?

Badge +11

Hi, see the attached site workflow.

This is based on Cassy's response. It shows all the records other than terminated one.

Reply