Start
Definition
That is the first step of the workflow. At that step, you could define the fields you want to show when the end users will go to generate a task and the transitions available.
Steps Tabs
Task details
This process type does not have task details for the start step.
Fields
In this tab, you could choose what fields the process form will show to the end users. You can choose these fields from all identity attributes, and from the attributes defined for the workflow on the Attributes Tab.
By default, all the identity attributes will be shown, and an additional field called Action. You can choose the fields you want to show when the end-users, add new fields, and delete the fields that do not need to generate a task. Also, you can sort the fields, you only need to do drag and drop on the Order column.
The Action field is a droplist that will allow end-users to select one of the different options to perform. The available actions, defined by default on the Attributes tab:
- Add user: action uses to generate a task to create a new identity (a new identities).
- Enable user: action uses to create a task to enable a identity who is disabled.
- Modify user: action uses to create a task to modify identity attributes.
- Disable user: action uses to create a task to disble identity.
To enable, modify or disable a identity, you need to add a field with the name userSelector, defined on Attributes tab. That field will be available, to end-users, to select an existing identity when select one of that options. When you select an identity, Soffid will show all the attributes defined on the form to the end-user.
For each field, you may indicate if it is a readOnly field, and you may add Validation script and Visibility script. The validation script allows you to define rules, the field has to comply with these rules. The visibility script allows you to define the rules to show or hide a field.
Validation examples
if (value == null || value.equals(""))
throw new Exception("The userName is mandatory");
else
return true;
It is also allowed in the following manner:
if (value == null || value.equals(""))
return ("The userName is mandatory");
else
return true;
Visibility example
&&TODO&& Pendiente de revisar
if ("E".equals(executionContext.getVariable("userType")))
return false;
Triggers
On the trigger tab you could define different triggers using custom scripts. Those triggers will be launched with the events you will define.
- onLoad: you can use that trigger to perform some actions before the execution of the step.
- on PrepareTransition: you can use that trigger to perform some actions after the execution of the step and before to start a transition to another step.
- onChange: you can use that trigger to perform some actions hen the value of the attribute if changed. You could choose the filed from a list.
Example
1. Calculate the email when firstName or lastName change and depending on the userType:
firstName = (inputFields.get("firstName")!=null) ? inputFields.get("firstName").value : null;
lastName = (inputFields.get("lastName")!=null) ? inputFields.get("lastName").value : null;
userType = (inputFields.get("userType")!=null) ? inputFields.get("userType").value : null;
if (firstName!=null && !firstName.trim().isEmpty() &&
lastName!=null && !lastName.trim().isEmpty() &&
userType!=null && !userType.trim().isEmpty()) {
emailAddress = firstName + "." + lastName;
if ("E".equals(userType)) {
emailAddress = emailAddress + ".ext@soffid.com";
} else {
emailAddress = emailAddress + "@soffid.com";
}
inputFields.get("emailAddress").value = emailAddress;
}
You cand find more information about StandardUserWindow.java on Github.
2. Load the user data into the form.
user = serviceLocator.getUserService().getCurrentUser();
task.getVariables().put("action", "M");
task.getVariables().put("userSelector", user.userName);
workflowWindow.fetchUserAttributes()
Incoming transitions
This process type does not have task details for the start step.
Outgoing transitions
The Outcoming transition tab shows the next steps where the flow can go from the current step. When you create a process from a template or from scratch default outcoming transitions are defined. It is allowed to customize the default set up, add new transitions or delete transitions.
- From: current step.
- Incoming transition: name of the transition.
- To: the next step, where the flow go.
- Action: allows creating a custom script to perform specific actions.
When you create an outcoming transition, Soffid creates the proper incoming transition.
Example
GetValidation theof selectedmandatory user, and sent to the next step the fistName and a operation:
selector = executionContext.getVariable("userSelector");
user = serviceLocator.getUserService().findUserByUserName(selector);
executionContext.setVariable("testName", user.firstName);
executionContext.setVariable("testOperation", "CHECK");
Validations:fields:
a = executionContext.getVariable("firstName");
if (a==null || "".equals(a.trim()))
throw new Exception("First name is mandatory");
a = executionContext.getVariable("lastName");
if (a==null || "".equals(a.trim()))
throw new Exception("Last name is mandatory");
a = executionContext.getVariable("primaryGroup");
if (a==null || "".equals(a.trim()))
throw new Exception("Primery group is mandatory");
return true;