Hi,
I have an webserviceAfterCreate rule to return an attribute mapping. I see folderPath is getting printed in logs, but I cou’ldn’t able to map it back to the account.
Am I missing some configuration?
Rule:
import connector.common.JsonUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import sailpoint.connector.webservices.EndPoint;
import sailpoint.connector.webservices.WebServicesClient;
import sailpoint.tools.GeneralException;
import sailpoint.tools.Util;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.Integer;
try{
//Get create secret response
Map folderMap = (Map) JsonUtil.toMap(rawResponseObject);
String folderId = null;
String secretId = null;
log.error(“START GET FOLDER ID”);
log.error(“responseObject” + folderMap);
if(!Util.isEmpty(folderMap) && folderMap.containsKey(“folderId”)){
folderId = String.valueOf(folderMap.get(“folderId”));
}
if(!Util.isEmpty(folderMap) && folderMap.containsKey(“id”)){
secretId = String.valueOf(folderMap.get(“id”));
}
log.error(“END GET FOLDER ID”);
log.error(“GET FOLDER ID” + folderId);
log.error(“GET SECRET ID” + secretId);
Map headers = requestEndPoint.getHeader();
headers.put(“Accept”, “application/json”);
log.error(“GET HEADER” + headers);
String fullURL = requestEndPoint.getFullUrl();
String baseURL = fullURL.substring(0,fullURL.indexOf(“/v1/”));
String getFolder = baseURL+ “/v1/folders/” + folderId;
List
<String> allowedStatuses = new ArrayList();
allowedStatuses.add(“2**”);
Map args = new HashMap();
args.put(WebServicesClient.ARG_URL, getFolder);
//args.put(WebServicesClient.ARG_HEADERS, headers);
//args.put(WebServicesClient.ARG_ALLOWED_STATUSES, allowedStatuses);
restClient.configure(args);
log.error("Headers: " + headers);
log.error("Allowed Statuses: " + allowedStatuses);
String getFolderResponse = restClient.executeGet(getFolder, headers , allowedStatuses);
log.error("getFolderResponse : " + getFolderResponse);
// Parse the JSON response
JSONObject jsonObject = new JSONObject(getFolderResponse);
String folderPath = jsonObject.getString(“folderPath”);
log.error("secret created in folderPath : " + folderPath);
Map updatedMapInfo = new HashMap();
updatedMapInfo.put("folderPath", folderPath);
return updatedMapInfo;
}
catch(Exception e)
{
log.error("Error in the After Rule - Delinea service accounts: " + e.getMessage());
}
