Thursday, April 7, 2016

Setting Due Date (in business days) inside the workflow



We had a requirement to assign a task to the user but the due date has to be set to 5 business day (Just excludes Saturday & Sunday. Other company holidays are not considered) from the day task will be assigned. So the below code was added in "Before a Task is assigned" section in approval workflow.


The first line is self explanatory. In Second line copy the CurrentDate (long date) to a string variable called Variable:StringCurrentDate. Now the value of the string will of the format Thursday, April 07, 2016. Using copy function copied the first 3 characters which will be Mon, Tue, Wed etc. If the value is Mon, Tue.... Friday add 7 days, if Sun add 5 and if Sat add 6.


Then use the variable:date to set the task:due date.




No comments:

Post a Comment