Hi, I have a requirement that I need to call a workflow by using a rule.
Basically, I configured a Quick Link, when user click that quick link it will launch a workflow in that a form is there ad it will display the application name and operation (Group Addition or Group removal). Upon successful selection I need to call a workflow that take the data according to the application specific requirement. In that I am facing an issue to launch the workflow part. Is there any way to launch and provision the request into the target application.
Please find the reference rule here.
<![CDATA[
import java.util.HashMap;
import sailpoint.api.sailpointContext;
import sailpoint.api.Workflower;
import sailpoint.object.Workflow;
import sailpoint.object.WorkflowLaunch;
import sailpoint.object.Identity;
log.error(“Executing the rule”);
// Create and set workflow variables. These are passed into the workflow.
HashMap launchArgsMap = new HashMap();
String identityID = wfcontext.getWorkflowCase().get(“quickLinkIdentityId”);
log.error("Launcher Name is:- " +identityID );
Identity currentUser = context.getObjectById(Identity.class,identityID);
String currentUserName = currentUser.getName();
log.error("User Launched the QuickLink is:- " +currentUserName);
//String identityDisplayName = context.getObject(Identity.class, identityID).getDisplayName();
String identityDisplayName = currentUser.getDisplayName();
log.error("DisplayName of the Launcher is:- " + identityDisplayName);
launchArgsMap.put(“identityName”,currentUserName);
launchArgsMap.put(“identityID”,identityID);
launchArgsMap.put(“identityDisplayName”,identityDisplayName);
Workflow wf = (Workflow)context.getObjectByName(Workflow.class,“My workflow”); //here i will fetch the wf value dynamically i have logic for that.
// Create and Configure WorkflowLaunch object
WorkflowLaunch wflaunch = new WorkflowLaunch();
wflaunch.setWorkflowName(wf.getName());
wflaunch.setWorkflowRef(wf.getName());
wflaunch.setVariables(launchArgsMap);
//Create Workflower and launch workflow from WorkflowLaunch
Workflower workflower = new Workflower(context);
WorkflowLaunch launch = workflower.launch(wflaunch);
log.error(“Workflow launched Successfully…”);
return wf;
]]>
After this step I need to return what and how to trigger the above workflow.