Trying to Delete records from Creator not found in CRM

Trying to Delete records from Creator not found in CRM

    Hi,

    In the following script, I am trying to delete records from Creator not found in CRM, but I am getting the error message "Error at line number: 55 Improper Statement
    Error might be due to missing ';' at end of the line or incomplete expression".

    Please advise on fix.

    1. void ZC_SyncCRMtoCreator()
    2. {
    3.     // Step 1: Fetch existing Creator records
    4.     existing_creator_records = Supplier_Sales_Data_Form[ID != 0];
    5.     creator_meid_map = map(); // MEID -> Record ID

    6.     for each rec in existing_creator_records
    7.     {
    8.         if (rec.MEID != null)
    9.         {
    10.             creator_meid_map.put(rec.MEID.toString(), rec.ID);
    11.         }
    12.     }

    13.     // Step 2: Fetch records from CRM
    14.     crm_response = invokeUrl
    15.     [
    16.         url : "https://www.zohoapis.com/crm/v2/Accounts"
    17.         type : GET
    18.         connection : "regional_suppliers"
    19.     ];

    20.     crm_data = crm_response.get("data");
    21.     crm_active_meid_map = map(); // MEID -> CRM record

    22.     for each crm_rec in crm_data
    23.     {
    24.         status = crm_rec.get("Status");
    25.         meid = crm_rec.get("MEID");

    26.         if (meid != null && status == "Active")
    27.         {
    28.             meid_str = meid.toString();
    29.             crm_active_meid_map.put(meid_str, crm_rec);
    30.         }
    31.     }

    32.     // Step 3: Insert new records from CRM to Creator
    33.     for each meid_str in crm_active_meid_map.keySet()
    34.     {
    35.         if (!creator_meid_map.containsKey(meid_str))
    36.         {
    37.             crm_rec = crm_active_meid_map.get(meid_str);
    38.             insert into Supplier_Sales_Data_Form
    39.             [
    40.                 Company_Name = crm_rec.get("Account_Name")
    41.                 MEID = meid_str
    42.                 Lead_ID = crm_rec.get("Lead_ID")
    43.                 Channel = crm_rec.get("Channel")
    44.             ];
    45.         }
    46.     }

    47.     // Step 4: Delete records from Creator not found in CRM
    48.     for each meid_str in creator_meid_map.keySet()
    49.     {
    50.         if (!crm_active_meid_map.containsKey(meid_str))
    51.         {
    52.             rec_id = creator_meid_map.get(meid_str);
    53.             delrec = Supplier_Sales_Data_Form[ID == rec_id];
    54.             if (delrec != null)
    55.             {
    56.                 delete delrec;
    57.             }
    58.         }
    59.     }

    60.     info " CRM sync complete.";
    61. }