Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Schedule a workflow conditionally


Hello peers,


Is there a way we can schedule a workflow conditionally? Here in our case, I need to schedule a workflow to run specifically on 15th business/working day of every month. Well, I have created a table in the database for a list of all 15th business/working days for each month up to an year from now. But I am not sure how can I use that in the scheduler. Please advise.


Thanks in advance.


Hey @timewaste 


As far as I know, there are a few ways to do this, which can depend on what else is happening in your workflow / what is most appropriate for you to implement. One option is to still have the schedule run every day (or even Mon-Fri), but also do any 1 of the following:


1) Create a timestamp (DateTimeStart() or use the Date Time Now tool), which you then append to the start input of your workflow. As long as this is then formatted the same as your list of acceptable dates, you could join your two streams (main input and your list of acceptable dates); this will either pass all records through into your workflow through the middle of the join (if it is 15th business day), or no records will run through after this point (if it's any other day), which will stop your main data hitting anything downstream


2) Use the test tool: this allows you to build in condition(s) to your workflow that - if the workflow doesn't meet - will intentionally error your workflow (so can cancel running any further). Like above, you could reference fields or write formulas to build this condition. More info here: 


3) There's another route which involves no changes to your existing workflow, but breaks out the 'test element' into its own start workflow, which is run first as a 'runner' feeding a 'conditional runner' macro: these macros allow you to run an individual workflow, and if it runs successfully (i.e doesn't error) can kick off another. These are CREW macros, so will require downloading if you don't  have them already. These tools (along with the others included in the free download) are very useful for this and many other things. Link here: 


Hope that helps. 



@andyuttley Absolutely, I have come up with your 3rd suggestion earlier and I found two things:


1. Conditional Macro doesn't retrieve any log information when the workflow runs on the gallery.

2. I have been noticing an error (mentioned below) randomly when it runs. I am not sure if it is even related to it yet I can't ask the support as this is a 3rd party macro.


Please advise.


Hi @timewaste,


There is no way to reflect this in the scheduler setup, but there are many ways to reflect this in the workflow itself.


You would need to query this source and bring a flag/value to the workflow - the most efficient way i can think this can be deployed is using Conditional Runner from CREW Macro Pack:


Your main workflow should run as 2nd and thus if date check does not apply it will not initiate (well, it will not initiate if the 1st workflow creates an error, so the trick now is to create a workflow that simulates an error when your date does not apply - there are surely many ways to do this, you could write data to a temp file for example, where no data would result in a workflow failure).


So here is example setup:


1) workflow 1 runs fine so that the 2nd workflow executes fine as well



2) workflow 1 completes with errors and thus 2nd workflow does not run at all






#Excuse me, do you speak Alteryx?






1. Conditional Macro doesn't retrieve any log information when the workflow runs on the gallery.



Great. The gallery won't expose the logs of the individual workflows because they're now embedded within your new 'runner workflow'; they are still there though, just within the outputs of the runner tools. In fact, as part of your same CREW download you should have the Log Parser tool, which you can place after your S/F outputs - you can obviously write these to an output if you needed to see the logs. 


As for your error, I'd check whether the workflow runs OK outside of any CREW runner setup. Just because one of your errors appears to be related to a spatial plugin based on the image you provided... 


Hopefully this and the great examples from @rafalolbert get you to a working solution! 


@timewaste Hi,


I do not upload the actual workflows because of iterative changes we make in sprint. Instead i keep in shared drive and upload a Mothership workflow which will pickup the individual workflow and run them sequentially. You can use something similar to thing by replacing the formula and link it to you table


In my workflow only the rows that are true are passed on to the List Runner by CreW.