Update Record

This function is used to update an existing record.

  • Function: UpdateRecord(<Object Name>, <Matching Field>, <XML Data>, <use ExternalID>)
    • var ObjResult = UpdateRecord(<Object Name>, <Matching Field>, <XML Data>, <use ExternalID>);
    • var status = ObjResult.msgSuccess;
    • var message = ObjResult.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>"

Value

"</Matching Field Name>"
"<Field Name>"

Value

"</Field Name>"
"<Field Name>"

Value

"</Field Name>"
"</Object Name>"
"</Data>"

  • Usagevar objTask = GetDataByID(GetRecordGUID(),"Task", "Id,Name,Start,End,Description,Location,Attendees,OwnerId");

var offset = GetTimeZone();
var xmlStr = "<Data>";
xmlStr += "<Task>";
xmlStr += "<Id>";
xmlStr += objTask.Id;
xmlStr += "</Id>";
xmlStr += "<Name>";
xmlStr += objTask.Name;
xmlStr += "</Name>";
xmlStr += "<Start>";
xmlStr += objTask.Start + offset;
xmlStr += "</Start>";
xmlStr += "<End>";
xmlStr += objTask.End + offset;
xmlStr += "</End>";
xmlStr += "<Description>";
xmlStr += "Meeting";
xmlStr += "</Description>";
xmlStr += "<Location>";
xmlStr += "Beirut, Lebanon";
xmlStr += "</Location>";
xmlStr += "<Attendees>";
xmlStr += objTask.Attendees;
xmlStr += "</Attendees>";
xmlStr += "<OwnerId>";
xmlStr += objTask.OwnerId;
xmlStr += "</OwnerId>";
xmlStr += "</Task>";
xmlStr += "</Data>";

var ObjResult = UpdateRecord("Task", "Id", xmlStr, false);
var status = ObjResult.msgSuccess;
var message = ObjResult.msgInfo;

  • Output:
    • Success:
      A success flag is returned with value = true.
      The following message will be displayed “New record is updated successfully.”
    • Failure:
      A success flag is returned with value = false.
      An error message will be displayed..
Was this article helpful to you? Yes No

How can we help?