Update Mass Records

This function is used to update mass records and it returns a message result that contains the updated records and the errors.

  • Function: UpdateMassRecords(<Object Name>, <Matching Field>, <XML Data>, <use ExternalID>)
    • var ObjResult = UpdateMassRecords(<Object Name>, <Matching Field>, <XML Data>, <use ExternalID>);
    • var message = msgInfo;
    • Use External Id: if the value is false, then you must send the GUID of the lookup fields in the XML data otherwise send the external Id value. Also if the parameter useExternalID is not existing in the function parameters, then it will considered as it is set to true.

XML Data Format:

"<Data>"
"<Object Name>"
"<Matching Field Name>"
   Value1
"</Matching Field Name>"
"<Field Name>"
   Value1
"</Field Name>"
"<Field Name>"
   Value1
"</Field Name>"
"</Object Name>"
"<Object Name>"
"<Matching Field Name>"
   Value2
"</Matching Field Name>"
"<Field Name>"
   Value2
"</Field Name>"
"<Field Name>"
   Value2
"</Field Name>"
"</Object Name>"
"</Data>"
  • Usage:
var xmlStr = "<Data>";
xmlStr += "<Contact>";
xmlStr += "<Name>";
xmlStr += "Elise Alice";
xmlStr += "</Name>";
xmlStr += "<First_Name>";
xmlStr += "Elise";
xmlStr += "</First_Name>";
xmlStr += "<Last_Name>";
xmlStr += "Alice";
xmlStr += "</Last_Name>";
xmlStr += "<Email>";
xmlStr += "elise.alice@gmail.com";
xmlStr += "</Email>";
xmlStr += "<OwnerId>";
xmlStr += "freddy.fares@aliston.fr";
xmlStr += "</OwnerId>";
xmlStr += "<IsDeleted>";
xmlStr += 0;
xmlStr += "</IsDeleted>";
xmlStr += "</Contact>";
xmlStr += "<Contact>";
xmlStr += "<Name>";
xmlStr += "John Smith";
xmlStr += "</Name>";
xmlStr += "<First_Name>";
xmlStr += "John";
xmlStr += "</First_Name>";
xmlStr += "<Last_Name>";
xmlStr += "Smith";
xmlStr += "</Last_Name>";
xmlStr += "<Email>";
xmlStr += "john.smith@gmail.com";
xmlStr += "</Email>";
xmlStr += "<OwnerId>";
xmlStr += "freddy_fares@aliston.fr";
xmlStr += "</OwnerId>";
xmlStr += "<IsDeleted>";
xmlStr += 0;
xmlStr += "</IsDeleted>";
xmlStr += "</Contact>";
xmlStr += "</Data>";

var ObjResult = UpdateMassRecords("Contact", "Email", xmlStrContact, true);
var message = ObjResult.msgInfo;
  • Output:

    • The result message will be displayed as follow:
      • Success Records: Matching Field + “ – “ + Record GUID + “ – “ + True
      • Failed Records: Matching Field + “ – “ + Error Message + “ – “ + False
    • Example:
      • “john.smith@gmail.com – Email:This Record does not Exist – False;elise.alice@gmail.com  – 1825492168588921251 – True;”
Was this article helpful to you? Yes No

How can we help?