Manipulation in Web Services After Operation Rule

Hi all, trying to write a Web Services After operation rule for after account aggregation. End goal is to read in a manager attribute, do some simple sting manipulation then put it onto the account for all accounts.

List list = new ArrayList();
List Finallist = new ArrayList();
Map account = new HashMap();
ArrayList accountList = new ArrayList();
if(null!=rawResponseObject){
  Map jsonResultMap = (Map) JsonUtil.toMap(rawResponseObject);
  List profiles = JsonUtil.get(jsonResultMap,"profiles");
  //profiles currently has all users inside from raw get response
  // Each iteration in this loop represents an account - pretty sure
  for(int i=0;i < profiles.size(); i++){
      Map itemJsonMap = JsonUtil.toMap(JsonUtil.toStringOrJson(profiles.get(i)));
      String supervisor = itemJsonMap.get("attributes.assignment_manager").toString();
      int firstP = supervisor.indexOf("(");
      String managerEmail= supervisor.substring(firstP+1, supervisor.length()-1);
      account.put( "managerEmail", "managerEmail");
      accountList.add(account);
  }
}
Map accountListMap = new HashMap();
accountListMap.put("data", accountList );

I have not been successful. This will not do anything. I even created a dumbed down version to try doing this statically and that wont work either. Any help is appreciated!

Map account = new HashMap();
Map accountListMap = new HashMap();
List accountList = new ArrayList();
log.error("##Start");
account.put("Manager Email", "[email protected]");
accountList.add(account);
accountListMap.put("data", accountList );
log.error("##end");
return accountListMap;

My thought is that we are putting my [email protected] to the account attribute “Manager Email” but it is not populating

If we start with your simplified example, you’ll also need to include the Account ID attribute and possibly the Account Name attribute in your static account. Attribute names returned in the rule are case-sensitive and must exist in the account schema in order to be aggregated.

If that doesn’t help, are your start and end messages being logged to the VA to confirm the rule is being executed?

Looks quite similar to rule we have for NERM / SecZetta, see if this gets you there:

import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Iterator;
List list = new ArrayList();
if (processedResponseObject != null){
  for (Map iterateMap : processedResponseObject) {
    if (iterateMap != null ) {
      String managerValue = iterateMap.get("assignment_manager");
      if(managerValue != null){
        managerEmail = managerValue.substring(managerValue.indexOf("(") + 1, managerValue.length()-1);
        managerEmail = managerEmail.trim();
        iterateMap.put("managerEmail", managerEmail);
      }
    }
    list.add(iterateMap);
  }
}
return list;

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.