15. The Do Until loop will complete until the variable counter matches the variable workdays.
16. In the final step we update the DueDate in the Work Progress Tracker list for the current item using the SharePoint – update item action.
Expressions:
a. ID
i. Value: @{triggerOutputs()?['body/ID']}
b. Title
i. Value: @{triggerOutputs()?['body/Title']}
c. Start date
i. Value: @{triggerOutputs()?['body/StartDate']}
d. Task Completion WorkDays
i. Value: @{triggerOutputs()?['body/TaskDays']}
e. Due date
i. Value: @{variables('DueDate')}
Hi,
Thank you for sharing the flow.
I have tried to create a flow taking this flow as a reference. My requirement is that I have a list that gets populated with content requests of different priorities. I want to calculate the due date based on the priority criteria and calendar days.
There seems to a problem in step 6a. Initializing the variable value with int(triggerOutputs()?['body/TaskDays']). It shows error:
Unable to process template language expressions in action 'Initialize_variable_WorkDays' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
I made the value 0 and tested it.
Another error in step 6c:
Unable to process template language expressions in action 'Initialize_variable_StartDate' inputs at line '0' and column '0': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.
Removed the format and tested with blank value.
Another error in step 7/8
Unable to process template language expressions in action 'Compose_IncrementStartDate' inputs at line '0' and column '0': 'In function 'addDays', the value provided for date time string '' was not valid. The datetime string must match ISO 8601 format.'.
Please check the flow once with these errors and help.
Thanks,
Ray
Please check the internal names for the columns created in steps 2 and 3.
In our case, we have used short field names and you might be using different field names.
Ref: Get SharePoint Column Internal Names
Hope this helps!
Thank you so much for writing this blog. I was struggling with the best way to process this logic.
I have gone through all the steps but I found an issue.
Step 6c - We create DueDate with no value
Step 8 - Compose to increment StartDate, but the variable in the instruction is DueDate:
addDays(Variables('DueDate'),1,'yyyy-MM-dd'). This results in an error as we cannot add days to a blank value.
ERROR:
InvalidTemplate. Unable to process template language expressions in action 'Compose_to_increment_StartDate' inputs at line '0' and column '0': 'In function 'addDays', the value provided for date time string '' was not valid. The datetime string must match ISO 8601 format.'.
I surmised that we should initalize the DueDate with the same expression as the StartDate, and this now works.
Thank you again.
Hi Fleur,
There was an issue in the Due Date step - we have fixed it and updated the post. Please re-check the steps and implement it.
Sorry for the inconvenience caused !
Regards,
Jasjit
Hi, can this workflow be used "When an item is created or modified"? I want to calculate the due date once the status is updated to "Submitted" not when the item is created. On step 6, what is "TaskDays" referring to as I don't see that column on any of the sharepoint lists? I'm also getting an error message in the Flow checker for the variable DueDate: "Actions in this flow may result in an infinite trigger loop. Please ensure you add appropriate conditional checks to prevent this flow from triggering itself."
You are most likely missing step 6(d) where we initiate DueDate variable.
And yes, you can use this flow for "When an item is created or modified".
Hope this helps!
Hi Reshma,
We had to update our blog. There was a mistake in the Due Date step. Sorry for the inconvenience caused.
Regards,
Jasjit