'In a Sharepoint 2013 workflow, How do you perform a multi-criteria lookup on a calendar event that spans multiple days?
I've been beating my head against this code for almost a week now so any help would be greatly appreciated.
I have two different lists. The first, List A, is a calendar that contains three tasks each that span a two week time frame and they contain a field labeled 'Assigned to'. The tasks then repeat every two weeks with the assigned to persons rotating through each tasks
List B is a task checklist that has daily checks for each of the tasks in list A. As the task is checked off each day, I have the task get recreated with tomorrow's date, however I need too automatically set the 'assigned to' of the task based on matching the task names then finding the task that has the Due Date that falls between the Start and End times.
List A (Calendar)
| Task Name | Start Date | End Date | Assigned to |
|---|---|---|---|
| Task A | 4/1/2022 | 4/14/2022 | Person A |
| Task B | 4/1/2022 | 4/14/2022 | Person B |
| Task C | 4/1/2022 | 4/14/2022 | Person C |
| Task A | 4/15/2022 | 4/29/2022 | Person B |
| Task B | 4/15/2022 | 4/29/2022 | Person C |
| etc... |
List B (Task Checklist)
| Task Name | Due Date | Assigned to |
|---|---|---|
| Task A | 4/16/2022 | Person B |
| Task C | 4/12/2022 | Person C |
| etc... |
My current code is below.
Step: 1 - Determine Reocurrence and set new task date
If Current Item:Occurrence equals Daily
Add 0 months, 1 days, 0 hours, 0 minutes to Current Item:Due Date (Output to Variable: NewStartDate )
If Current Item:Occurrence equals Weekly
Add 0 months, 7 days, 0 hours, 0 minutes to Current Item:Due Date (Output to Variable: NewStartDate )
If Current Item:Occurrence equals Monthly
Add 1 months, 0 days, 0 hours, 0 minutes to Current Item:Due Date (Output to Variable: NewStartDate )
Loop: 1
The contents of this loop will run repeatedly while: Variable: NewStartDate is less than or equal to Today
Add 0 months, 1 days, 0 hours, 0 minutes to Variable: NewStartDate (Output to Variable: NewStartDate )
Log Variable: NewStartDate to the workflow history list
Step: 2 - Fix NewStartDate to Skip Weekends
Log Checking to see if NewStartDate is on... to the workflow history list
Set time as 0 : 0 for Variable: NewStartDate (Output to Variable: WeekendCheck )
Find days between 1/3/2022 12:00:00 AM and Variable: WeekendCheck (Output to Variable: DaysBetweenMondayandDueDate )
Calculate Variable: DaysBetweenMondayandDueDate mod 7 (Output to Variable: Mod7DueDate )
If Variable: Mod7DueDate is greater than 4.95
Add 0 months, 2 days, 0 hours, 0 minutes to Variable: NewStartDate (Output to Variable: NewStartDate )
Log Variable: NewStartDate to the workflow history list
Step: 3 - Create the New Task and Send Email
If Current Item:Status equals Completed
Create item in Storage Tasks Checklist (Output to Variable: NewTaskItem )
Email Bridges, Terry
Log Recurrence was successfully updated to the workflow history list
If Current Item:Status equals Pending
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
