Sample Scripts BPM
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;
}