Test Create operation for Webservice from DEBUG

Hi all,

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?

Thanks in advance

You can call the provisioning plan from the debug page for a particular application.

Depending on the operation type, your configuration will be invoked. You can call that plan from a test rule.

@sukarande Can you please help me with a snippet

I have two attributes that I need to pass
username and email

You can add those attributes in the plan. If you want to change anything in the payload, handle it in the before operation rule.

Hi @rishavghoshacc ,

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

@rishavghoshacc Have you tried the rule shared by @Chathuryas . Please let us know if you still need any help.