Outgoing triggers examples
Attribute mapping triggers
When you are configuring an agent and defining the attibute mappings of a connectors, depending on the connector type, it will be able to define BeanShell scripts that will be triggered when data is loaded into the target system (outgoing triggers).
Triggers can be used to validate or perform a specific action just before performing an operation or just after performing an operation into target objects.
The trigger result will be a boolean value, true to continue or false to stop.
Use case examples
Example 1
A user can have more than one account on a target system. We want to reconcile only those accounts which have the same name on Soffid and on target system.
name = newObject{"accountName"};
uaList = serviceLocator.getAccountService().findUsersAccounts(name,"agentName");
for(userAccount: uaList) {
if (userAccount.name.equals(name)) {
return true;
} else {
return false;
}
}
return false;
Example 2
Update only users who belong to Soffid company.
name = newObject{"accountName"};
user = serviceLocator.getUserService().findUserByUserName(name);
if (user != null) {
attributes = serviceLocator.getUserService().findUserAttributes(name);
company = attributes.get("company");
if (company != null && company.equals("Soffid")) {
return true;
}
return false;
Tips
Write into sync-server log
System.out.println("what you want......");
Use existing services
serviceLocator.getUserService().....
serviceLocator.getAccountService().....
serviceLocator.......