Setting up the initial variable

Setting up the initial variable

I am trying to set up a script to copy the contents of certain fields from the contact module to the deals module (renamed to Proposed Systems).  I keep getting an error about thee variable declaration on line 2?  What am I missing?

Error:  "Failed to save the function
  • Variable 'proposed_system_id' is not defined Line Number: 2"
Script:

// Use the input variable for the Proposed System ID
proposed_system_id = proposed_system_id;  // The variable set manually

// Fetch the Proposed System record using the ID provided by the workflow
proposed_system = zoho.crm.getRecordById("Proposed_Systems", proposed_system_id.toLong());

if(proposed_system != null)
{
    // Get the contact ID from the Proposed System's "Contact_Name" lookup field
    contact_id = proposed_system.get("Contact_Name");  // Replace "Contact_Name" with the actual API name of your lookup field in Proposed Systems

    // Check if the Proposed System has an associated Contact
    if(contact_id != null)
    {
        // Fetch Contact details using the contact ID
        contact_info = zoho.crm.getRecordById("Contacts", contact_id.toLong());

        if(contact_info != null)
        {
            // Fetch all Proposed Systems associated with this contact
            proposed_systems = zoho.crm.searchRecords("Proposed_Systems", "(Contact_Name:equals:" + contact_id + ")");

            if(proposed_systems.size() > 0)
            {
                for each proposed_system_record in proposed_systems
                {
                    // Map the contact fields to the Proposed System fields
                    proposed_system_map = Map();
                    proposed_system_map.put("Email", contact_info.get("Email"));
                    proposed_system_map.put("Phone", contact_info.get("Phone"));
                    proposed_system_map.put("Mailing_City", contact_info.get("Mailing_City"));  // Replace with your actual field names

                    // Update each Proposed System with the contact information
                    update_proposed_system = zoho.crm.updateRecord("Proposed_Systems", proposed_system_record.get("id").toLong(), proposed_system_map);

                    // Check if the update was successful
                    if(update_proposed_system.get("status") == "success")
                    {
                        info "Proposed System " + proposed_system_record.get("id") + " updated successfully with Contact information";
                    }
                    else
                    {
                        info "Failed to update Proposed System " + proposed_system_record.get("id");
                    }
                }
            }
            else
            {
                info "No Proposed Systems found for this contact.";
            }
        }
        else
        {
            info "Contact not found.";
        }
    }
    else
    {
        info "No contact associated with this Proposed System.";
    }
}
else
{
    info "Proposed System not found.";
}