Can anyone help with this.
This is my first go at coding.
Here's my Code.
// Trigger this script when the customer number is entered
// Get the customer number entered by the user
customer_number = input.Customer_Number.toLong(); // Convert the customer number to a long integer
// Fetch all contact records (you can limit the number if needed)
contact_records = zoho.crm.getRecords("Contacts", 1, 5000);
found_record = null;
// Iterate through the records to find the matching Customer Number
for each contact_record in contact_records
{
if(contact_record.get("Customer_Name").toLong() == customer_number) // Match the customer number
{
found_record = contact_record;
// Auto-populate the fields in the "System Services" module
input.Contact_Name = contact_record.get("Contact_Name");
input.Phone = contact_record.get("Home_Phone");
input.Mobile = contact_record.get("Mobile");
input.Email = contact_record.get("Email");
input.Council = contact_record.get("Council");
input.Street = contact_record.get("Mailing_Street");
input.City = contact_record.get("Mailing_City");
input.State = contact_record.get("Mailing_State");
input.Postcode = contact_record.get("Mailing_Zip");
input.Installation_Date = contact_record.get("Install_Date");
break;
}
}
// Handle the case where the customer number isn't found
if(found_record == null)
{
info "Customer not found!";
}