Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Knowledge Base

Definitive answers from Designer Desktop experts.

How to run a workflow from an event

EricWe
Alteryx
Alteryx
Created

How to run a workflow from an event

 

A Run Command Event can run another workflow automatically when the first workflow finishes.

 

Prerequisites

 

A Desktop Automation, Engine API, or Server license is required to use Run Command Events.

 

Procedure

 

Click in a blank space on the Canvas, then go to the Workflow – Configuration screen and select the Events tab. Next, click on Add and Run Command.

 

The Run Event When options are:

  • Before Run: Runs the command before the workflow runs.
  • After Run: Runs the command after the workflow runs.
  • After Run with Errors:Runs the command after the workflow, but only if the workflow ran with errors.
  • After Run Without Errors: Runs the command after the workflow, but only if the workflow ran without error.
  • Disabled:Turns the event off.

Command: should be set to C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe

(change C: if necessary to the drive with the Alteryx installation)

Command Arguments: list the workflow name run by the event, including the file extension .yxmd.

Working Directory: set to the folder location of the workflow run by the event

 

EricWe_0-1582514167871.png

If there is a space in the folder directory, the folder path and the file name must all be in the Command Arguments surrounded by quotes.


image.pngimage.png

Alternatively, you can have the event run the workflow from a batch file. Other commands can run from a batch file as well.

 

Start with a new Notepad document and add the commands using this syntax.

“C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe” C:\Alteryx\Workflows\ EventWorkflow.yxmd

 

First, call the AlteryxEngineCmd with the full path enclosed in double-quotes. Use quotes for any command where the folder path has a space, such as between the words in the folder name Program Files. Next, add a space, and then the location of the workflow the event will run, including the workflow name and file extension.

 

After saving the file, right-click, select Rename, and then change the file extension from .txt to .bat. The file is ready to use in a Run Command Event. Just call the batch file in the Command, for example:

 

EricWe_1-1582514167876.png

 

Additional Resources

 

Workflow Configuration Help Page 
Scheduling Workflows Using Event Run Command 
Chaining Workflows Together  


 

Comments
TimN
13 - Pulsar

Eric,

Would the workflow or workflows executed this way be queued on the Controller?  We have Alteryx Server.  If I was using this method (C:\Program Files\Alteryx\Bin\Alteryxengine.exe MyWorkflow.yxmd) from an external scheduler how would that impact performance?  Any further detail is appreciated.

 

Thank You,

 

Tim

EricWe
Alteryx
Alteryx

Hi @TimN

 

Yes, the workflow events can be run on the Server. Since the events occur sequentially, it should not affect performance in terms of exceeding the limit for simultaneous workflows configured in System Settings. The best practice is to divide the number of processor cores by two and not exceed that number in the simultaneous workflows setting. If the limit is reached based on that setting, other workflows may queue up and wait to be processed.

TimN
13 - Pulsar

Eric,

Thanks!

 

Tim

smysnbrg
8 - Asteroid

@ericwe

 

Can you please confirm that one needs to have the Alteryx Server Engine API License in order to utilize a command such as:

 

C:\Program Files\Alteryx\Bin\Alteryxengine.exe MyWorkflow.yxmd

 

Server 2020.2.3.27789

 

Steven

EricWe
Alteryx
Alteryx

Hi @smysnbrg

 

You can also run a workflow from the Command Prompt with a Designer Desktop Automation license. 

FreeRangeDingo
11 - Bolide
11 - Bolide

I keep getting this error...

The external program "C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe" returned an error code: 1: Too many posts were made to a semaphore. (298).

 

Any ideas.  Search didn't turn up much.

EricWe
Alteryx
Alteryx

HI @FreeRangeDingo

 

The error could have many possible causes. Please contact support@alteryx.com so we can research it further. 

kedar26
7 - Meteor

Asking this because I have an Alteryx server environment and 50 workflows previously being called via a single master workflow configured using in a CREW macro's "run if success" tool (which we are not going to use considering a few performance downsides). So here are three scenarios and I want to know how the controller and it's queue manage workflows in three the scenarios.

 

1. Is to schedule or let user run the 50 individual workflows on the server one after the other.

2. Chain the apps in sets of 7 so the limitation of running each under 30 seconds can not hamper the flow.

3. Use the command line.

 

In all of the above 3 I want to know if point 2 or 3 has some benefit wrt to server performance and if calling the AlteryxEngineCmd.exe to run the workflows on the server causes any kind of instability as opposed to the usual scheduling/uploading of the server we do in general.

 

EricWe
Alteryx
Alteryx

Hi @kedar26,

 

If the workflows must follow a specific order, it is best to use Run Command events from the Workflow - Configuration Events tab or allow plenty of time between separate schedules.


The number of Simultaneous workflows is set in the Alteryx System Setting on the Worker General tab. The best practice is to configure this setting to be half the amount of physical processor cores on the server, as each workflow uses two cores. Any additional workflows should queue up and wait to be processed. I suggest checking this setting to ensure no resource contention could delay the completion of a workflow and cause separate schedules to complete out of sequence.


The Interface Designer option On Success - Run Another Analytic App only works if there is user input for each workflow in the chain.

KatarinaRadic
6 - Meteoroid

Hello, maybe you can help me with this error I am unable to resolve:

I am trying tio execute a simple workflow which will trigger another simple workfow:

KatarinaRadic_1-1625487245029.png


I followed all the instructions but I keep getting this error: Error: Designer x64: The Designer x64 reported: Error running Event #1: The external program "C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe" returned an error code: 2: The system could not find the environment option that was entered. (203)

I even followed the instructions from this article: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Error-quot-The-system-could-not-fin... ,but the error persist.

I am using Designer with Desktop Automation licence.

Thank you in advance.

Katarina

EricWe
Alteryx
Alteryx

Hi @KatarinaRadic

 

Please contact support@alteryx.com. It would be helpful to research this issue in a meeting. 

 

 

KatarinaRadic
6 - Meteoroid

Hi @EricWe , thank you.
I actually managed to fixed it: the problem was in the name of the workflow, it should be without spaces, once i renamed it from event 2.yxmd to event2.yxmd it worked. 
On the other hand, I am getting the same error when I try to  create an event in event2.yxmd, or in other words, I can't run an event from a workflow that was ran from an event itself.

EricWe
Alteryx
Alteryx

Hi @KatarinaRadic

 

It should be possible to set up a chain of workflow Run Command events where more than two workflows run automatically. I suggest enabling the Engine logs and checking the log file after reproducing the issue. This article has instructions. 
 
Also, you can use a CReW Runner macro tool to have a workflow call another workflow. This tool is available as part of an add-on download. Please see this article for details.  
Watsa
8 - Asteroid

@KatarinaRadic 
Thank you very much for the updated post. I have updated my workflow name without spaces and it works perfectly.

IraWatt
17 - Castor
17 - Castor

@EricWe Thanks for the post was very useful 

seven
12 - Quasar

@EricWe 

Great post, I've recently used it successfully, thank you.

 

When a user creates a Send Email event, there are a host of variables available, including the %OutputLog%. How can I use this variable, and others, in a Run Command event? I need to use the log in the Run Command workflow and I don't have access to any of the logs on Alteryx Server. I cannot use the original wf to output the log because it might not be available upon wf failure.

EricWe
Alteryx
Alteryx

Hi @seven

 

The Send Email event is designed to interpret the %OutputLog% text variable. Commands started by a Run Command event would not directly have access to that variable.

 

You can run a Send Email event only after a workflow runs without errors, or use the Run Command to call another workflow that contains a Send Email event.