This code will help you validation zip codes on submit from a form / survey. Use the custom code action in the GHL workflow.
// Retrieve the input parameters from GHL
// Define the list of allowed ZIP codes
const validZipCodes = [
"12344", "12345", "12345"
];
// Function to check if the ZIP code exists in the list
function isValidZip(zip) {
return validZipCodes.includes(zip);
}
// Output result back to GHL
return {
is_valid: isValidZip(inputZip),
zip_code: inputZip
};