I want to test the Create Account operation for a Web service Application that I am trying to onboard. I want to have a code snippet that I can run from Debug page that only calls this operation and executes it. This way I can test the before and after operation rules.
How can I achieve this using beanshell from the DEBUG page?
You can use the following sample code to trigger the create operation in webservices application. Save the code as a Rule in debug page and run the rule.
import org.apache.log4j.Logger;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan.AccountRequest.Operation;
import sailpoint.object.ProvisioningPlan.Operation;
import sailpoint.object.Identity;
import sailpoint.object.ProvisioningProject;
import sailpoint.api.Provisioner;
String identityName = ""; // Give any user identity name
String userName = " "; // User name attribute
String email = " " ; //User email attribute
String appName = " " ; //Give webservices application name
ProvisioningPlan plan = new ProvisioningPlan();
Identity identity = context.getObjectByName(Identity.class,identityName);
if(identity!=null){
plan.setIdentity(identity);
AccountRequest accReq = new AccountRequest();
accReq.setOperation(AccountRequest.Operation.Create);
accReq.setApplication(appName);
accReq.add(new AttributeRequest("username",ProvisioningPlan.Operation.Add,userName)); //give username attribute correctly
accReq.add(new AttributeRequest("email",ProvisioningPlan.Operation.Add,email));
plan.add(accReq);
}
Provisioner provisioner = new Provisioner(context);
ProvisioningProject project = provisioner.compile(plan);
provisioner.execute(project);
Hi @rishavghoshacc ,
In the create account operation before rule, try to modify the provisioning plan object as required like sending only username and email, then test the create account operation. If you need to do any modifications, then modify in the before and after operation rules