Get operation from an attribute request

Hello developers

I have a before provisioning connector rule that gets the entitlements of an access request that assigns or removes groups in an application. For the add events the rule works correctly, but I am trying to get those attribute requests that the operation is a remove, I put a validation and to get the value of the operation I use the getOperation() method, but when I run a test it returns the following error:

Error in method invocation: Method getOperation() not found in class java.util.ArrayList

These are the classes that I import in the rule:

import sailpoint.object.Identity;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.api.IdentityService;
import sailpoint.api.SailPointContext;
import sailpoint.tools.GeneralException;
import java.util.List;
import java.util.Map;
import java.net.URLEncoder;

Here is an example of the provisioning plan that processes the rule:

<ProvisioningPlan nativeIdentity="12345">  
    <AccountRequest application="MySource [source]" nativeIdentity="[email protected]" op="Modify">    
    <AttributeRequest name="groups" op="Remove">     
        <Attributes>       
            <Map>
                <entry key="comments" value="Test Access Request"/>
            </Map>      
        </Attributes>      
            <Value>        
                <List>          
                    <String>Entitlement1</String>
                    <String>Entitlement2</String>        
                </List>      
            </Value>
        </AttributeRequest>  
    </AccountRequest> 

How can I get the value of the request attribute operation to be able to perform my validation?

I hope you can help me.

Regards.

Hi @jacob_islas ,

Here is the code for before provisioning rule to get accountRequest operation.

if (plan!=null) {
    List accountRequests = plan.getAccountRequests();

    if (accountRequests!=null) {
        for (AccountRequest accountRequest : accountRequests) {
            AccountRequest.Operation op = accountRequest.getOperation();

            Identity identity = plan.getIdentity();
            String applicationName = application.getName();
            String nativeIdentity = accountRequest.getNativeIdentity();

            List attributeRequests = accountRequest.getAttributeRequests();
}}}

Hope this helps! Thanks!

Thanks @GOKUL_ANANTH_M but the operation that I need is the attributeRequest

<AttributeRequest name="groups" op="Remove">

In my code I’m try access through of the next validation:

if ("Remove".equals(attrRequests.getOperation())){
                    boolean hasRemove = true;
                }

But I get the error Error in method invocation: Method getOperation() not found in class java.util.ArrayList

Regards.

Try

if ("Remove".equals(ProvisioningPlan.AttributeRequest.getOp())){
                    boolean hasRemove = true;
                }

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.