Webservice Add Entitlement

Which IIQ version are you inquiring about?

8.2

Hello Community,

I am using webservice connector add entitlement operation to provision user access (Assign user account with entitlement).
I need to send account attribute “userid” in json body this is going as null as userid is not part of provisioning plan.

I tried using $plan.userId$ in the body but no use , how can i send account attribute in the json using before provisioning plan in Add Entitlement Operation. Below is my code snippet

  import org.json.JSONArray;
  import org.json.JSONObject;
  import sailpoint.connector.webservices.EndPoint;
  import sailpoint.object.ProvisioningPlan;
  import sailpoint.object.ProvisioningPlan.AccountRequest;
  import sailpoint.object.ProvisioningPlan.AttributeRequest;
  import java.util.Map;

  
  Map body = requestEndPoint.getBody();
  String jsonBody = (String) body.get("jsonBody");
  JSONObject jsonObj = new JSONObject(jsonBody);
  JSONObject modifiedJson = new JSONObject();
  
  AccountRequest accReq = provisioningPlan.getAccountRequest("Application_Name");
  log.error("Modify accReq: " +accReq);
  if (accReq != null && jsonObj != null) {
	JSONObject userReqMsg = jsonObj.get("userRequestMessage");
	if (userReqMsg != null) {
		userReqMsg.put("code", accReq.getAttributeRequest("code").getValue().toString());
		userReqMsg.put("userId", accReq.getAttributeRequest("userId").getValue().toString());
		modifiedJson.put("userRequestMessage", userReqMsg);
	} else {
		log.error("jsonObj.get(\"userRequestMessage\") is null");
	}
	
  }
  requestEndPoint.getBody().put("jsonBody", modifiedJson);

Hi @shivakarasani199,

if you want use $plan.userId$, you must add userid into a prov. form or the update prov.form or you can add a prov.form on the BS\IT role you are assigned.

Also, you can add manually in a before operation or in before provisioning rule.

Hi @enistri_devo thank you for the response, I have added update prov form with below rule , i can see the link attribute sending userId in the logs but the user id is not synching into request body json when using $plan.userId$

Update Prov Rule

if(link!=null ){
log.error("Print Link: "+link.toXml());
if( link.getAttribute("userId")!=null){
log.error("userId :"+link.getAttribute("userId"));
return link.getAttribute("userId");
}
}

Anything missing to add link attribute in JSON body, thanks

if print the plan, you can see the userId into it?

Hi @enistri_devo

I am able to resolve it using link object in before provisioning rule

thanks

1 Like