Simple switch case
Depending on the lead type, this sample JavaScript or Groovy custom scripting function sets values for a variety of fields accordingly.
If the mapped values are static, this type of mapping requirement can often be met using a cross reference table. This logic could also be implemented as a series of if/else statements.
| Inputs | - leadType (Character) |
| Outputs | - salesRep - priority |
Script
switch (leadType) {
case"Direct":
salesRep = "Kevin";
priority = "High";
break;
case"Referral":
salesRep = "Louisa";
priority = "Low";
break;
case"Reseller":
salesRep = "Sarah";
priority = "Medium";
break;
case"OEM":
salesRep = "Sarah";
priority = "Low";
break;
default:
salesRep = "Adam";
priority = "Medium";
}