community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!
SOLVED

C# Engine Plugin flag for validation run

Alteryx Partner

When Alteryx sends through a 0 record run for validation purposes, is there any way to know the difference between this and a user or scheduled execution of the workflow that happens to have 0 records when it gets to the tool? From a use case, if a tool does something that has external implications, like create a file, send an email, hit a webservice, etc. I don't want to do so on the validation run, only on an actual run. It maybe that 0 rows is in fact relevant to the tools purpose, so that isn't a good indicator.

I think you can do this with the engineInterface object you receive in the PI_Init method.  The object has this method:

 

engineInterface.GetInitVar()

 

According to the Python SDK, one of the possible values is 'UpdateOnly'.  This seems to return 'True' when sending a validation record and 'False' when the workflow is actually running.

 

The AlteryxRecordInfoNet.InitVar enumeration doesn't have an UpdateOnly value, but fortunately you can pass an arbitrary string to GetInitVar.  So you should be able to do something like this in your code when you need it:

 

if (engineInterface.GetInitVar("UpdateOnly") == "False")
{
    // Do whatever external stuff you need here
}
else
{
    // You can do validation-only code here
}
Alteryx Partner

Exactly what I needed, thanks!