oldResponseMap in WebServices Before Rule

Hi!
I have configured http operation of same type (i.e. Account Aggregation -1 and Account Aggreagtion -2). I want to use the response of Aggregation 1 in Aggregation 2 operation but when I am fetching the value of oldResponseMap in before rule then it’s giving null value.
Any suggestion?

Hi Deepak,

Welcome to SailPoint Developer Community.

Can you share response mapping of the first endpoint (Aggregation-1) and your operation rule

Thanks,
Shailee

1 Like

Hi @deepakarora ,

Make sure you declare the Account Aggregation - 1 as parentEndPoint for second operation. Also, declare the response mapping for account aggregation - 1 operation.

oldResponseMap object should not be null in before operation rule of second endpoint if above operations are configured as suggested, it will still be null in the rule of first operation. Make sure you add the loggers to identify the operation endpoint as the values are populated only for the second one.

Regards,
Uday Kilambi

2 Likes

Hi @deepakarora ,

I forgot to mention another point if it is still not working for you. Make sure you have the input argument declared to your rule.

       {
            "name": "oldResponseMap",
            "description": "earlier response object ",
            "type": null
        }

Regards,
Uday Kilambi

hi @deepakarora,

If oldResponseMap does not work for you. The way I usually do is get the response of Aggregation-1 in body section of Aggregation-2 using $response.attributeName$ script. You can refer this values in beforeoperation rule using requestEndPoint. A Sample code to retrive these values can be something like this

 Map accountReqBody = requestEndPoint.getBody();
            
if (accountReqBody != null && !accountReqBody.isEmpty()) {
	String accountRequestBody = (String) accountReqBody.get("jsonBody");
	
	if (Util.isNotNullOrEmpty(accountRequestBody)) {
		Map accountRequestMap = JsonUtil.toMap(accountRequestBody);
		
		if (accountRequestMap != null && !accountRequestMap.isEmpty()) {
			accountRequestMap.get("id"); // here you can get all the response values of first aggregation once you add them in body
		}
	}
}

Thanks,
Uday Putta

I solved the issue by hitting the API from after rule. Thanks for all your response.

1 Like