fewthiraphat
(Thiraphat Itamonchai)
September 19, 2025, 8:04am
1
Version 8.4
Hello Everyone,
I would like to ask for your guidance regarding the after rule for a WebService. I have configured the account schemas for my application, as shown in the attached image.
When I click Preview , no data is displayed. However, I can see the data in the Tomcat logs.
Could you please advise on how to correctly map this data to the account schema?
Thank you in advance for your support.
asharma65
(Ashish Sharma)
September 19, 2025, 8:10am
2
Hello @fewthiraphat
As I can see you are trying to use afterrule to parse response coming from API call. Can you try below code after fine tunning it.
import sailpoint.object.;
import java.util.org.apache.log4j.Logger;
import net.minidev.json.*;
Logger logger = Logger.getLogger(“WS-AfterRule”);
public List getObjects(ResourceObject obj, Map context) throws Exception {
List accounts = new ArrayList();
// Parse the raw response (JSON string)
String response = (String) context.get("response");
if (response != null) {
// Example for JSON array
JSONArray jsonArr = (JSONArray) JSONValue.parse(response);
for (Object o : jsonArr) {
JSONObject jo = (JSONObject) o;
ResourceObject acct = new ResourceObject();
acct.setIdentity((String) jo.get("userId")); // unique attribute
acct.put("userId", jo.get("userId"));
acct.put("firstName", jo.get("firstName"));
acct.put("lastName", jo.get("lastName"));
acct.put("email", jo.get("email"));
accounts.add(acct);
}
}
return accounts;
}
Let me know if it works
fewthiraphat
(Thiraphat Itamonchai)
September 19, 2025, 8:21am
3
Hello @asharma65 , I tried to use your code for testing, but seems still not working
asharma65
(Ashish Sharma)
September 19, 2025, 9:27am
4
@fewthiraphat Can you try to do response mapping for your schema attributes.