Table of contents


i
This is not the latest version of this document; to access the latest version, click here.
Official Content

In most cases it is useful to start a process from outside the GXflow inbox. This HowTo will explain the basics of starting a process from outside the Inbox.

Note: the following code does not control for errors to avoid complexity.

//Connect to workflow and start the process
WFsession.Connect(<user>, <password>, &error)
&WFSession.GetProcessDefinitionByName(<the activity diagram name>, &process, &error)
&process.CreateInstance(&processInstance, &error)
&processInstance.Subject = <set the subject for the inbox if you want>

//Set your application data
&processInstance.GetApplicationDataByName(<your application data name>, &WFApplicationData, &error)
&WFApplicationData.NumericValue = <the id of whatever you are processing in the workflow process>
&processInstance.Start(&error)

//If you stop here, somebody can go to the inbox and the task will appear there, but if you want to run the first task now, you have to invoke it:
&process.GetActivityByName(<the name of your first task>,&activity,&error)
&processInstance.GetWorkitemByActivity(&activity,&workItem,&error) 
call(<your first activity object> ,&process,&processInstance,&workItem)

Note: in this case, to actually start the process, it is necessary to perform a Commit. Be aware that when using any of the Workflow Data Types exclusively, GeneXus doesn't commit automatically. So performing a commit is always required in order for changes to take place. Also take into consideration the LUW, when using the Workflow Data Types, to properly manage data.

The variables are defined as follows:

&WFSession = WorkflowServer
&Error = Workflow Error
&Process = WorkflowProcessDefinition
&WFApplicationData = WorkflowApplicationData
&Activity = WorkflowActivity
&processInstance = WorkflowProcessInstance

See also

HowTo: Start a Process from an External Application


 
Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant