The construction of a wizard action is almost the same as the construction of a rule action, except the action identifies and uses parameters in different ways. For details about wizard page actions, see Wizard Automated Actions.
You can use the following examples of wizard page actions in Java. These actions execute when the wizard user clicks next to go to the next wizard page.
•Setting User with Specific Role in Project as Task Assignee
•Filtering Users for Manual Selection
•Automatically Selecting Project Assignees
Automated actions in wizards can create related records for a main record. While you can also create related records through a template, by creating related records through a page action, you can specify that the related record only create when certain conditions exist.
In this example, when the Any Injuries? checkbox is selected in a wizard, the system creates a child BI Claim. The following wizard action automatically creates a child BI Claim project.
What User Does On Wizard Page |
User selects the Any Injuries? checkbox (a wizard parameter of type Boolean) in the First Notice of Loss wizard |
Wizard Page Action |
Create a child Claim with the default category Bodily Injury |
Sample Values |
Object Definition: CLAM (custom object Claim) Categories: CLAM_BOIN Custom Fields: None Wizard Parameters: anyInjury (boolean) |
Java Wizard Action: Creating a Child Project
public class CreatingAChildProject extends CustomAction<Project> {
@Override public void action(final Project project) { // Get wizard parameter final boolean isAnyInjury = parameters.getBooleanParameterValue("anyInjury");
// Run as system user to bypass security platform.getUtilityService().runAsSystemUser(new Callable() {
@Override public void call() { // Create new claim as a child of the project Project claim = platform.getProjectService().newProject("CLAM"); claim.setParentProject(project);
// Add BI category as primary claim.setPrimaryCategory("CLAM_BOIN"); } }); } } |
The wizard action automatically assigns the task to the first user who has the Proposed Attorney assignee role in the matter.
What User Does On Wizard Page |
User adds an assignee to the matter wizard. |
Wizard Page Action |
Checks the role of the assignee, and if a user has the Proposed Attorney role, add this user as the assignee to the template-created task record associated with the wizard. |
Sample Values |
Object Definition: MATT (custom object Matter) Assignee Roles: MATT_PRAT (Proposed Attorney) Categories: None Custom Fields: None Wizard Parameters: project (project) Related Object: task (a Task) |
Java Wizard Action: Setting User with Specific Role as Assignee in Task
public class SettingUserWithRoleAsAssigneeInRelatedTask extends CustomAction<Task> {
@Override public void action(final Task task) { // Retrieve project wizard parameter final Project project = parameters.getProjectParameterValue("project");
// Run as system user to bypass security platform.getUtilityService().runAsSystemUser(new Callable() {
@Override public void call() { // Get list of project assignees List<ProjectAssignee> assignees = project.getAssignees();
for (ProjectAssignee assignee : assignees) { // Assign the project assignee with the 'Proposed Attorney' role if (assignee.getAssigneeRole().equals("MATT_PRAT")) { platform.getTaskService().reassign(task, assignee.getUser()); break; } } } }); } } |
The following wizard page action assigns a list of users to a project when they have a certain primary category in their contact records.
What User Does On Wizard Page |
User selects Bodily Injury as the default category for a claim record. |
Wizard Page Action |
Selects all BI adjusters and lists them as assignees on the project. |
Sample Values |
Object Definition: CLAM (custom object Claim) Assignee Roles: ADJU (BI Adjuster) Categories: CONT_ADJU_BIAD (category of Contact) Custom Fields: None Wizard Parameters: None |
Java Wizard Action: Filtering Users for Manual Selection
public class FilteringUsersForManualSelection extends CustomAction<Project> {
@Override public void action(final Project project) {
// Run as system user to bypass security platform.getUtilityService().runAsSystemUser(new Callable() { @Override public void call() { List<User> users = platform.getUserService().getAllUsers();
for (User user : users) { // If the user's contact's primary category is BI Adjuster, add to adjusters if (user.getContact().getPrimaryCategory().getTreePosition().equals("CONT_ADJU_BIAD")) { project.addAssignee("ADJU", user); } } } }); } } |
The following wizard page action first checks whether the claim record created by the wizard has the category BI. It then gets a list of users by checking the default category (Bodily Injury) and the value in the Is available checkbox in the user's contact record. The action also assigns the first available BI Adjuster to the claim and then clears the Is available checkbox.
What User Does On Wizard Page |
User adds the Bodily Injury category to a claim record created through a wizard. |
Wizard Page Action |
Assigns the first available BI Adjuster to the claim by checking the default category (Bodily Injury) and the value in the Is available checkbox in the user's contact record. Then, clears the Is available checkbox. |
Sample Values |
Object Definition: CLAM (custom object Claim) Assignee Roles: CLAM_ADJU (Claim Adjuster) Categories: CLAM_BDIN (category in Claim) CONT_ADJU_BIAD (category in Contact) CONT_ADJU (category in Contact) Custom Fields: isAvailable (checkbox in Contact) Wizard Parameters: None |
Java Wizard Action: Automatically Selecting Project Assignees
public class AutomaticallySelectingProjectAssignee extends CustomAction<Project> {
@Override public void action(final Project project) { try { platform.getUtilityService().runAsSystemUser(new CallableWithException<Exception>() {
@Override public void call() throws Exception { // Check whether BI Category has been added to the claim record boolean isBI = project.hasCategory("CLAM_BDIN");
// Get all users List<User> users = platform.getUserService().getAllUsers();
for (User user : users) { // Check primary category and value of Is Available field on each user's contact Contact contact = user.getContact(); if (contact.getPrimaryCategory().equals("CONT_ADJU_BIAD") && contact.getBooleanFieldValue("CONT_ADJU", "isAvailable")) { // Add the user as a project assignee with the role BI Adjuster project.addAssignee("CLAM_ADJU", user);
// Make the contact no longer available contact.setBooleanFieldValue("CONT_ADJU", "isAvailable", false); } } } }); } catch (Exception e) { // Log a message with the exception attached logWarn("The category CLAM_BDIN was not added to Claim", e); } } } |