This article helps users to create a platform user in AgileApps by using addRecord java API. Place the following code in the call method and invoke this from the business rule.
Code snippet:
Parameters userParams = Functions.getParametersInstance();
userParams.add("first_name","John");
userParams.add("last_name", "Bob");
userParams.add("email", "xxx@softwareag.com");
userParams.add("username","john.bob");
userParams.add("time_zone", "23"); // Get the value of the select box option from browser inspector
userParams.add("team_id", "xxx"); // Get the respective id from teams.
userParams.add("access_profile_id", "xxx"); // Get the respective id from access profiles.
userParams.add("user_type", "P"); // Platform user
userParams.add("notify_by_email", "0"); // 1=send message with system-generated password. 0=don't
userParams.add("password", "xxxx"); // Set a fixed initial password when notify_by_email is 0.
userParams.add("application_id", "xxx"); // Get the respective id from applications list.
userParams.add("role_id", "xxxx"); // Get the role id from application roles
Result r = Functions.addRecord("USER", userParams);
if (r.getCode() < 0) {
String msg = "Error while adding User record:\n"+ r.getMessage();
// To show the error in the UI.
Functions.throwError(msg);
} else {
// have code for successful user creation
}