BrianK
Scholar

How do I schedule a site workflow to use the current date for start data

Jump to solution

I have a site workflow that has a single start data value of a date/time variable called dtTodaysDate. In the workflow I have the variable set to default to "Today's Date", show on Start Form, required and display as Date Only. Note that I have built a start form in case a user needs to run the workflow adhoc passing in a specific date.

When I schedule the workflow I want it to run daily indefinitely and to use the current days date. When scheduling, it prompts me to select a start date for dtTodaysDate, I left it as the current date and saved.

The first scheduled run was correct using the date shown in the start variable. Subsequent days however always use that same first day as when I scheduled it.

I know it is possible to do as we have another scheduled site workflow doing this but I can't seem to figure out how it was done.

0 Kudos
Reply
3 Replies
ethurber
Scout

Re: How do I schedule a site workflow to use the current date for start data

Jump to solution

Hi.

If the value will always be the date the workflow was executed, I recommend setting the dtTodaysDate variable to the Start Date context variable from within the workflow. 

ethurber_0-1634661260870.png

 

This eliminates the need to prompt for it during initiation.

 

Hope this helps

0 Kudos
Reply
BrianK
Scholar

Re: How do I schedule a site workflow to use the current date for start data

Jump to solution

That would totally work when running the workflow from the schedule. The problem is, if for whatever reason they wish to manually start the workflow and pass in a historical date using the start form it would always use the current date when the workflow starts, overwriting the value they selected for dtTodaysDate on the start form.

0 Kudos
Reply
ethurber
Scout

Re: How do I schedule a site workflow to use the current date for start data

Jump to solution

Hi.

 

How about this. 

Make the date an optional field.  If they enter a value, use that one.  If it's left blank, then use Start Date.

View solution in original post

Reply