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 value of the qualified name property of the activity diagram>, &process, &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>
//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)
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
HowTo: Starting a Process from an External Application