Which IIQ version are you inquiring about?
Version 8.4
Share all details related to your problem, including any error messages you may have received.
Hello
I am provisioning to an application called Cority. It requires the employee number every time in the body of the request when an update is sent.
The body of the POST request needs to be formatted in this way. I can’t get the employeeNumber to be sent everytime. I have been trying in the before operation rule below but it doesn’t put the employeeNumber in the right spot.
{
"options": {
"autoCreatePortalUser": "true",
"updateExistingRecords": "true",
"insertBaseTables": "true",
"forceLookupTableUpdate": "true",
"disableSegUpdate": "true",
"dateFormat": "mm/dd/yyyy"
},
"records": [
{"employeeNumber": "$plan.employeeNumber$",
"firstName": "$plan.firstName$",
"middleName": "$plan.middleName$",
}
]
}
Before operation rule
import connector.common.JsonUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import sailpoint.object.Identity;
import sailpoint.object.Link;
import sailpoint.object.Application;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan.AccountRequest;
log.error("xxx Starting Cority before operation rule");
//gather objects to get cority ID for the endPoint
Application Cority = context.getObjectByName(Application.class,"Cority");
myIdentity = provisioningPlan.getNativeIdentity(); //returns guid string
Identity identity = null;
identity = context.getObject(Identity.class,myIdentity);
Link corityLink = identity.getLink(Cority);
corityId = corityLink.getAttribute("id");
empNumber = corityLink.getAttribute("employeeNumber");
Map body = requestEndPoint.getBody();
String jsonBody = (String) body.get("jsonBody");
log.debug("Rule - Modify Body: running");
try {
Map jsonMap = JsonUtil.toMap(jsonBody);
if (jsonMap != null) {
// Extract the records
List records = (List) jsonMap.get("records");
log.error("xxx records size " +records.size());
// Add employeeNumber
for(int i = 0; i < records.size(); i++) {
Map record = (Map) records.get(i);
log.error("xxx record " + record);
log.error("xxx records.get " + records.get(i));
record.put("employeeNumber", empNumber);
log.error("xxx record after " + record);
}
}
String finalBody = JsonUtil.render(jsonMap);
body.put("jsonBody", finalBody);
requestEndPoint.setBody(body);
} catch (Exception ex) {
log.error("Rule - Cority Before Opertaion Modify Body: " + ex);
}
Map body = requestEndPoint.getBody();
log.error("xxx map body value is : "+body);
String jsonBody = (String) body.get("jsonBody");
log.error("xxx jsonBody value is : "+jsonBody);
Map jsonMap = JsonUtil.toMap(jsonBody);
log.error("xxx jsonMap value is:"+jsonMap);
return requestEndPoint;
log.error("Ending before operation rule");