Cross-Entity Javascript RRS feed

  • Question

  • I have two Entities 'A' and 'B'.

    I would like that when I change a field in Entity A then a field in Entity B changes.

    I can update fields on one Entity when fields change on that same Entity using Javascript.

    Does anyone know if it is possible to update a field in Entity B when a field in Entity A is changed?


    • Edited by JMcCon Thursday, November 6, 2014 12:42 PM
    Thursday, November 6, 2014 12:42 PM

All replies

  • Hi,

    It can be done using Workflows or plugins.

    Regards, Saad

    Thursday, November 6, 2014 12:56 PM
  • Yes you can do it, 

    Approach 1:
    you can write a plugin on Entity A : on Create or Update message.
    and write a code to Update the Entity B into that plugin.
    So, it will execute once you Create or Update the Entity A and will update the Entity B accordingly.

    Approach 2:
    You can write client script onload of EntityA, to update the EntityB field

    Approach 3:
    You can use Workflow also

    Thursday, November 6, 2014 12:58 PM
  • Thanks for all the replies.

    Anyone have any sample code to do this?


    Thursday, November 6, 2014 1:29 PM
  • first reffer SDK.REST.js script file from CRM SDK (path is sample_/Scripts/SDK.REST.js)

    function updateEntityB_record(RecordId) {
        var entityB = {};
        entityB.Name = "Updated text";

            function () {
            function () {
    Thursday, November 6, 2014 2:14 PM