Trace: • Start Workflow on Server Side
If you want to start a specific workflow on server side in an action of your life-cycle object, it's straight forward. Simply use the workflow access object and call one method:
WorkflowAccess wfa = WorkflowAccess.getCurrentInstance(); Obejct id = wfa.startWorkflow(worfklowNameOrId);
Be careful if you run above code outside the life cycle scope because
WorkflowAccess.getCurrentInstance();
tries to get the workflow access object via SessionContext.
If you don't run inside the life cycle scope, use
WorkflowAccess wfa = new WorkflowAccess(); wfa.setDBAccess(dbAccess);
instead.