HashMap<String,Object> map = new HashMap<String,Object>();
map.put("allowRequestsWithViolations","true");
map.put("approvalMode","serial");
map.put("approvalScheme","none"); // For auto approval
map.put("AppName",applicationName); //Target applcation name
map.put("doRefresh","true");
map.put("enableRetryRequest","false");
map.put("fallbackApprover","spadmin");
map.put("flow",requestType);
map.put("foregroundProvisioning","true");
map.put("identityDisplayName",identityName);
map.put("identityName",identityName);
map.put("identity",identity);
map.put("notificationScheme","user,requester");
map.put("optimisticProvisioning","true");
map.put("plan",plan);
map.put("policiesToCheck","");
map.put("policyScheme","continue");
map.put("policyViolations","");
map.put("project","");
map.put("requireViolationReviewComments","true");
map.put("securityOfficerName","");
map.put("sessionOwner","spadmin");
map.put("source","LCM");
map.put("trace","true");
map.put("violationReviewDecision","");
map.put("workItemComments","");
//Create WorkflowLaunch and set values
Workflow wf = (Workflow) context.getObjectByName(Workflow.class,"Mighty - LCM Provisioning");
WorkflowLaunch wflaunch = new WorkflowLaunch();
wflaunch.setWorkflowName(wf.getName());
wflaunch.setWorkflowRef(wf.getName());
wflaunch.setCaseName("customProvToDB");
//Launch workflow for application provisioning
wflaunch.setVariables(map);
wflaunch.setWorkflow(wf);
//Create Workflower and launch workflow from WorkflowLaunch
Workflower workflower = new Workflower(context);
WorkflowLaunch launch = workflower.launch(wflaunch);
String workFlowId = launch.getWorkflowCase().getId();
log.error("workFlowId: "+workFlowId);