| Name | Type | Description |
|---|---|---|
| record | sys.data.Record | The record where the interaction will be executed. |
| interaction | sys.data.Interaction | Interaction object to access parameters of the interaction. |
//validates the zip code using an external service
var errors = [];
var zipCode = interaction.field('address.zipCode').val();
if (!app.endpoints.addressValidator.isValidZipCode(zipCode)) {
errors.push({
path: 'address.zipCode',
code: 'invalid',
message: 'Wrong zip code'
});
}
return errors;