HowTo: Starting a Process from an External Application

Official Content
This documentation is valid for:

Suppose we need to start a process instance every day at morning, the steps to follow will be the following:

1) Create a Genexus procedure with the Main program property in 'Yes', Call Protocol property with the 'Command line' value and the following source code: 

&server.connect('<User_Name>','<User_Password>')
&process = &server.GetProcessDefinitionByName('<process_name>')
&procInstance = &process.CreateInstance()
&procInstance.Subject = '<process_instance_subject>' //optional, by default is the process definition name 
&procInstance.Start()
commit

Where the data types variables are the following:

&server         - WorkflowServer
&process        - WorkflowProcessDefinition
&procInstance   - WorkflowProcessInstance

Note: <User_Name> must be an administrator user. 

2) Create a .bat file with the following source code:

cd <path file>
a<procedure_name>.exe 

For example:

cd C:\Models\GXFLOW_X_KB\CSharpModel\Web\bin
a<procedure_name>.exe

3) Include this .bat file into a windows scheduled task.

 




Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.