locked
Populate Lookup Value via sdk.jquery.updaterecord on a related entity RRS feed

  • Question

  • I have an html webresource that on click of a button displays a popup if a certain flag is not true. If user chooses yet we set the flag. However I also need to populate a user lookup field that is on a related entity within the javascript.

    I have the id, name , entity type of the user that should populate the lookup field on the related entity but it is not populating correctly and must be erroring out in the script:

    sample code is below.  I've changed the names of variables and entity name to be generic

    var

    value = newArray();

                    value[0] =

    newObject();

                    value[0].id = User.Userid;

                    value[0].name = User.UserName;

                  value[0].entityType = User.UserEntityType

     

                  customentity.booleanfield =

    true;

                   

         


                  customentity.lookupfieldid = value[0].id;

                  customentity.lookupfieldidname = value[0].name;

                 

                 

                   

                    SDK.JQuery.updateRecord(EntityId, customEntity,

    "customentity")

    The code above works if I am only attempting to set the Boolean field on the related entity and comment out the code related to setting the lookup. 


    Robert

    Tuesday, September 29, 2015 3:24 PM