locked
CRM 2013: Change regarding objectid through Javascript RRS feed

  • Question

  • Hi everyone,

    I have created a ribbon button to change the regardingobjectId of the emails from one duplicate case to another. I am using the XRMServiceToolkit to perform an update on the regarding field. Code Below:

    var updateEmail = new XrmServiceToolkit.Soap.BusinessEntity("email", duplicateActivityList[s].attributes["activityid"].value);

    updateEmail.attributes["regardingobjectid"] = { value: originalCase.attributes["incidentid"].value, type: "EntityReference" };
    var updateResponse = XrmServiceToolkit.Soap.Update(updateEmail);

    The update works fine when I tested it on other fields. Any ideas please?

    Thanks


    Darren Mercieca

    Friday, October 10, 2014 8:28 AM

Answers

  • Hello,

    Try to use something like

    updateEmail.attributes["regardingobjectid"] = { id: originalCase.attributes["incidentid"].value,  logicalName: "incident", type: "EntityReference" };


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    • Marked as answer by darrmerc Friday, October 10, 2014 8:46 AM
    Friday, October 10, 2014 8:40 AM
    Moderator

All replies

  • Hello,

    Try to use something like

    updateEmail.attributes["regardingobjectid"] = { id: originalCase.attributes["incidentid"].value,  logicalName: "incident", type: "EntityReference" };


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    • Marked as answer by darrmerc Friday, October 10, 2014 8:46 AM
    Friday, October 10, 2014 8:40 AM
    Moderator
  • Thanks that worked! :)

    Darren Mercieca

    Friday, October 10, 2014 8:46 AM