cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run rule task - With custom input and return values

Run rule task - With custom input and return values

This is to run a rule with our custom code. IdentityIQ already provides the Run Rule option, but we need to specify all the values in config argument. There may be scenarios where we want to select objects from drop down and want to send values to the rule.

 

To implement this here, I am using rule that is executed with RunRule task definition, but it takes the input values from the TaskDefinition.

For example, here I implemented deleting users by running the rule:

 

Delete user executing in background:

 

Labels (1)
Attachments
Comments

Helpful documente

Hi,

Instead of "identities"  I want to select "Task Schedule".

In code u have specified type="identities"

If I want to display Task Schedule name what "type" I need to mentioned?

Can u please help me on this?

Is there any sample code for deleting the users from a particular target application in SailPoint?

What are the different argument  types we can specify  while sending parameter to a rule.

Can we invoke a task from workflow?

 

 

thedefinite articleMore (Definitions, Synonyms, Translation)

import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningProject;
import sailpoint.object.Request;
import sailpoint.object.ProvisioningResult;
import sailpoint.object.Identity;
import sailpoint.object.Application;
import sailpoint.object.Link;
import sailpoint.object.*;
import sailpoint.api.*;


public ProvisioningPlan buildPlan(Identity identity, String appName, String nativeIdentity){
ProvisioningPlan plan = new ProvisioningPlan();
plan.setIdentity(identity);
AccountRequest disableAcctReq =new AccountRequest(ProvisioningPlan.AccountRequest.Operation.Disable,appName, null, nativeIdentity);
plan.add(disableAcctReq);
return plan;
}

public Link getNativeIdentity(Identity identity, Application app){
String nativeIdentity = null;
IdentityService is = new IdentityService(context);
List links = is.getLinks(identity,app);
for(Link link : links){
if(link.getApplicationName().equalsIgnoreCase(app.getName())){
return link;
}
}
}

public executePlan(Identity identity, Application app){
Provisioner p = new Provisioner(context);
p.execute(plan);

}


List bundleNamesList = new ArrayList();
ProvisioningPlan disablePlan = new ProvisioningPlan();
Filter f1 = Filter.eq("links.application.name",<app name>);
Application app = context.getObjectByName(Application.class,<app name>);
QueryOptions qo = new QueryOptions();
qo.add(f1);
// fetch users
List idenList = context.getObjects(Identity.class,qo);
// iterate users and fetch bundles
for(Identity iden : idenList ){
//if(iden.getName().equalsIgnorecase(<your identity name in double quotes>)
List bundleList = iden.getAssignedRoles();
for(Bundle bundle : bundleList){
bundleNamesList.add(bundle.getName());
}
if(!bundleNamesList.contains(app.getName())){
Link adLink = getNativeIdentity(iden,app);
String nativeIdenity = adLink.getNativeIdentity();
disablePlan = buildPlan(iden,app.getName(),nativeIdenity);
executePlan(disablePlan);

}
}

Version history
Revision #:
3 of 3
Last update:
‎May 02, 2023 02:53 PM
Updated by:
 
Contributors