I agree that it would be nice to have an easy way to populate existing attributes in an HTTP Operation. I have one connector that requires all attributes to be populated in order to update the account. The way I did this was through a Before Operation Rule. The rule does the following:
Get the current account attributes on the source for the impacted Identity, in our case the Get uses the same URL as the PUT for updating the account information.
Map that current account attributes
Map the attributes that have been specified in the Body of the Update Account Operation (requestEndPoint.getBody())
If the attribute exists in the request, put the request value into the mapping of the current account attributes.
Update the requestEndPoint Body with the updated current account information.
//Get Body from Request EndPoint
Map body = requestEndPoint.getBody();
//Get Header from Request EndPoint
Map header = requestEndPoint.getHeader();
if(body != null) {
String jsonBody = (String) body.get("jsonBody");
Map requestMap = JsonUtil.toMap(jsonBody);
WebServicesClient client = new WebServicesClient();
String accesslevelURL = requestEndPoint.getFullUrl();
Map args = new HashMap();
args.put(WebServicesClient.ARG_URL, accesslevelURL);
client.configure(args);
List<String> allowedStatuses = new ArrayList();
allowedStatuses.add("2**");
String response = client.executeGet(accesslevelURL, header, allowedStatuses);
//Get original attributes from Source
Map originalMap = JsonUtil.toMap(response);
//If Attribute is in the request, replace the attribute in the original information feed
if(requestMap.containsKey("firstName")){
originalMap.put("firstName", requestMap.get("firstName"));
}
if(requestMap.containsKey("lastName")){
originalMap.put("lastName", requestMap.get("lastName"));
}
if(requestMap.containsKey("emailAddress")){
originalMap.put("emailAddress", requestMap.get("emailAddress"));
}
body.put("jsonBody", originalMap);
//update body for the Request EndPoint
requestEndPoint.setBody(body);
}
return requestEndPoint;
I found, if you want all attributes to be sent in the update account, then I just suffix attribute name with an ‘x’ on the attribute in the provisioning plan, so it doesnt get removed before it hits the Before Operation rule.
It would be nice if the documentation was getting updated/improved. Finding the right way of doing things is currently pretty convoluted for new users, and it often involves having to search the discussion board for things that should be updated in the documentation (and often finding automatically closed discussions without any answer).