Skip to main content
Feedback

If/Else - multiple conditions

This sample JavaScript or Groovy custom scripting function illustrates the handling of multiple conditions using an If/Else block.

If the order amount is $10,000 or more or if the order is from a "Premier" customer and the amount is $5,000 or more, map the shipping method as "PRIORITY". Otherwise map whatever shipping method was specified on the order. Note that because shipMethod is defined as both an input and output, the output will be populated with the original input value even if the condition is false and no value is explicitly assigned to shipMethod in the script.

Inputs- amount (Float)
- custStatus (Character)
- shipMethod (Character)
Outputs- shipMethod

Script

if (amount >= 10000 || (custStatus == "Premier" && amount >= 5000) ) {
shipMethod = "PRIORITY";
}