1

I'm attempting to add a new field to a CRM Sandbox module that auto-populates with values from an existing field. I made a standalone function in the Developer Space, and I'm sure it's something ridiculous that I'm overlooking, but for the life of me I can't get the function to save or execute. It keeps kicking back a syntax error. Is what I'm trying to do even possible, or am I just completely missing something??

This is the basic code I'm trying to run, but I'm repeatedly getting syntax errors.



const fieldMapping = {

  "Analyst": "Other",

  "Customer": "Other",

  "Distributor": "Distributor/Aftermarket",

  "Integrator": "Distributor/Aftermarket",

  "Investor": "Other",

  "NULL": "Other",

  "Partner": "Other",

  "Reseller": "Distributor/Aftermarket",


};

function updateAccountType() {

  var recordId, field1Value, field2Value, records, i;

  records = zoho.crm.getRecords("Accounts");

  for (i = 0; i < records.length; i++) {

    recordId = records[i].get("id");

    field1Value = records[i].get("Account_Type");

    field2Value = fieldMapping[field1Value];

    zoho.crm.updateRecord("Accounts", recordId,{"Account_Type_v2": field2Value});

  }

}


0 Answers0