Unable to retrieve FirstName and LastName in Before Operation Rule for Web Services

Hello Sailpoint Community,

I’m currently working on a Before Operation Rule for a Web Services remove entitlement operation. I need to pass the FirstName and LastName in the request body, but I’m having trouble retrieving these values from the $plan object.

I’ve tried using $plan.firstName$ and $plan.lastName$, but these are coming back as null. I’ve also attempted to create a Before Provisioning Rule to get the values from the Identity object using identity.getFirstName() and identity.getLastName(), but this approach isn’t working either.

Error: Attempt to resolve method: getFirstname() on undefined variable or class name

Additionally, I’ve tried accessing the attributes using

Attributes attrs = identity.getAttributes()
attrs.getString("firstName"),

but this also throws an error.

Error: Attempt to resolve method: getAttributes() on undefined variable or class name

Has anyone else encountered this issue? Can someone please provide guidance on how to retrieve the FirstName and LastName attributes in a Before Operation Rule for Web Services?

Any help or suggestions would be greatly appreciated.

@sita_ram Refer below post:

Add/Remove Entitlement operation $plan placeholder issues - Identity Security Cloud (ISC) / ISC Discussion and Questions - SailPoint Developer Community

Try this:

  1. Parent endPoint - First get the account details and map those in response mapping
  2. Child endPoint - Get the values from Parent response and pass it to body.

Also to your point why you are not getting values using $paln.firstName$ etc.

you can only get the requested attribute from the plan.

For e.g. in this case you are trying to remove the entitlement, so you will only get which role is getting removed and the nativeIdentity in the plan not others.

For Create Operation you are getting all the required values from Create Profile and they are there in the provisioning plan.

Thank you for responding Shekar.

Can we get firstname and lastname from Sailpoint instead of making application’s GET account details call ?

We can get all the required attributes from sailpoint but for that first you need to set these attributes in plan using beforeProvisioning rule and then you can use those using beforeOperation rule.

Import sailpoint.object.Identity

if (null != plan) 
	{
     if (null != plan.getIdentity()) 
		{
			Identity identity = plan.getIdentity();
			AccountRequest srcAcctRequest = getAccountRequest();
			if (null != srcAcctRequest && null != srcAcctRequest.getOperation() &&
                Util.isNotNullOrEmpty(identity.getStringAttribute("cloudLifecycleState"))) 
			{

				String firstName = identity.getStringAttribute("firstname");
				String lastName = identity.getStringAttribute("lastname");
			}
		}
	}
1 Like

Okay, So, to set the firstname and lastname attributes, we should create a beforeProvisioning rule which is a cloud executed rule.

I have a question about retrieving these attribute values within the web service beforeOperation rule:

  • Would using identity.getFirstName() be the correct approach to fetch the firstname value in this context?

As I mentioned first set these attributes in provisioning plan, then get those attributes and their values using provisioningPlan argument in your beforeOperation rule and set your request body accordingly.

Please check below document
Web Services Before Operation Rule | SailPoint Developer Community

you can get the firstName, lastName etc using below in BOP rule

String firstName = (String) acctReq.getArgument("fristname");
String lastName = (String) acctReq.getArgument("lastname");

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