Skip to main content

form

Last updated 24/04/2024

form
property on the
Five
object in functions.

Example

The function checks if the value in the Quantity field on the current form is less than the value in the Quantity field on the Sells form in the

. It will also ensure it is less than the Holding query field in the metadata.

Check the value in the Quantity field on the Sells form in the stack
function CheckBuyQuantity(five: Five, context: any, result: FiveError) : FiveError {
const qty: number = parseInt(five.field.Quantity);
if (qty > five.form.Sells.Quantity) {
return five.createError(result, 'Stock quantity exceeds quantity in this sale');
}

if (qty > five.getMetadata('Allocations', 'BuyKey', 'Holding')) {
return five.createError(result, 'Stock quantity exceeds remaining stock in this buy');
}

return five.success();
}