Skip to main content

success()

Last updated 17/09/2024

Example

The following code calculates the total cost and sets it to the Total field, then returns a successful result.

CalculateTotal
function CalculateTotal(five: Five, context: any, result: FiveError) : FiveError  {
if (five.actionID() === 'Buys') {
five.field.Total = five.field.Quantity * five.field.Price + five.field.Fees;
} else {
five.field.Total = five.field.Quantity * five.field.Price - five.field.Fees;
}

return five.success();
}