This is one of the most common useful rules that we can do quickly from the debug as well in order to aggregate a single account from a single application. All you just have to do is provide the name of the application and the native identity of the account. You can add some extra entries to the task attributes if you want. You can run this rule from debug and verify the account.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="Test-Single-Account-Aggregation">
<Source>
<![CDATA[
import sailpoint.object.Application;
import sailpoint.object.Attributes;
import sailpoint.object.ResourceObject;
import sailpoint.object.TaskResult;
import sailpoint.api.Aggregator;
import sailpoint.connector.Connector;
/\*
\* Provide the appName and acctNativeIdentity below and run the rule in Debug
\*/
String appName = "Active Directory";
String acctNativeIdentity = "CN=bhanuk,OU=APAC Services,DC=office,DC=bpk,DC=com";
Application appObject = context.getObjectByName(Application.class, appName);
String appConnName = appObject.getConnector();
Connector appConnector = sailpoint.connector.ConnectorFactory.getConnector(appObject, null);
ResourceObject rObj = appConnector.getObject("account", acctNativeIdentity, null);
if(rObj!=null) {
Attributes argMap = new Attributes();
argMap.put("aggregationType", "account");
argMap.put("applications", appName);
argMap.put("descriptionAttribute","description");
argMap.put("descriptionLocale", "en_US");
argMap.put("noOptimizeReaggregation", "true");
Aggregator agg = new Aggregator(context, argMap);
TaskResult result = agg.aggregate(appObject,rObj);
return rObj.toXml();
} else {
return "The account: " + acctNativeIdentity + " can not be found.";
}
]]>
</Source>
</Rule>