Issues with updating a new Zoho CRM Record

Issues with updating a new Zoho CRM Record

Hello,

I have a Zoho Creator form that leads fill out. The information they input is sent to Zoho CRM in the form of a lead. This was working fine as just creating a CRM record, but I wanted to update the newly created CRM record with more information. This is where my issue lies.

As you can see from the code below, I am trying to retrieve the ID from the response object that was used to create the Leads record and use it to update that same record. The submission goes through with this code, but the extra information included in eventinfo and eventinfo2 is not included in the new lead on Zoho CRM. leadinfo does work.

(At one point, I used "leadID = response.get("id").toLong();" but it gave me the error "Error in executing On Create- On Success script. Value is empty and 'toLong' function cannot be applied")

  1. LeadDescription = "";
    LeadDescription = "Product: " + input.Products.Product + "  Background: " + input.Background.Background + "  Lights: " + input.Lights.Light + "  Layouts: " + input.Layouts.Layout + "  Props: " + input.Props.Prop;

  2. leadinfo = {"Last_Name":input.Contact_Person,"Company":input.Company,"Phone":input.Phone_Number,
  3. "Email":input.Email,"Event_Type":input.Event_Type,"Location":input.City_of_Event,"Description":LeadDescription,"
  4. Designation":input.Position,"Event_Location_Address":input.Address_of_Event,"Event_Venue":input.Event_Location_Venue_Name,
  5. "Location_Instructions":input.Location_Access_Instructions,"Day1_Event_Start_Time":input.Day_1_Photo_Booth_Start_Time};

  6. eventinfo = {"Day1_Event_End_Time":input.Day_1_Photo_Booth_End_Time,"Day2_Event_Start_Time":input.Day_2_Photo_Booth_Start_Time,
  7. "Day2_Event_End_Time":input.Day_2_Photo_Booth_End_Time,"Day3_Event_Start_Time":input.Day_3_Photo_Booth_Start_Time,
  8. "Day3_Event_End_Time":input.Day_3_Photo_Booth_End_Time,"Day4_Event_Start_Time":input.Day_4_Photo_Booth_Start_Time,
  9. "Day4_Event_End_Time":input.Day_4_Photo_Booth_End_Time};

  10. eventinfo2 = {"Day5_Event_Start_Time":input.Day_5_Photo_Booth_Start_Time,"Day5_Event_End_Time":input.Day_5_Photo_Booth_End_Time,"
  11. Day6_Event_Start_Time":input.Day_6_Photo_Booth_Start_Time,"Day6_Event_End_Time":input.Day_6_Photo_Booth_End_Time,"
  12. Day7_Event_Start_Time":input.Day_7_Photo_Booth_Start_Time,"Day7_Event_End_Time":input.Day_7_Photo_Booth_End_Time};

    response = zoho.crm.createRecord("Leads",leadinfo);
    leadID = response.get("id");

    response = zoho.crm.updateRecord("Leads",leadID,eventinfo);
    response = zoho.crm.updateRecord("Leads",leadID,eventinfo2);