CRM 2013 - Problems with Entity + Lookup RRS feed

  • Question

  • Hi,

    I have a Entity called accounts, within each record that's created additional Addresses can be added to the account. Which is done via a entity called Addresses with the Account address having a 1:N relationship

    My problem is when I'm creating a new address for a account I want to be able to access the Accounts information for certain field (To be used with a Plugin)

    However I cannot create a lookup field in the entity Addresses.

    I have also tried using the lookup field created when I created the Relationship type to try get the information I need from there but my JavaScript keeps returning 'Undefined' (not to be confused with a error message, simply the string is returned as undefined)

    Does anyone know what action I should take?

    Thanks, Shaun


    Friday, June 13, 2014 11:06 AM

All replies

  • You have to create a plugin 
    Friday, June 13, 2014 2:27 PM
  • Hi Shaun,

    Is this address new custom entity or you are using out of box customeraddress entity? if this is custom entity then you need this account look up field on form and then you will able to access this field on your custom address field...

    following is pseudo code on retrieving look up field value in Java script. 

    //Code Snippet:
    var lookupObject = Xrm.Page.getAttribute("yourlookupattributename");
        if (lookupObject != null)
            var lookUpObjectValue = lookupObject.getValue();
            if ((lookUpObjectValue != null))
             var lookuptextvalue = lookUpObjectValue[0].name;
             var lookupid = lookUpObjectValue[0].id;

    My Blog
    Follow Me on Twitter

    Saturday, June 14, 2014 10:21 AM
  • Hi

    I'll have to get back to you about the custom or out of the box entity.

    The code you provided is what I already have and returns the lookupid as 'unverified'

    Also in regards to having a lookup on the form, when I try putting a look up on the form it doesn't have any options to select a target record type

    Thanks, Shaun


    Monday, June 16, 2014 7:35 AM
  • Hi,

    Just been informed that the Entity 'Addresses' is an out of the box entity

    Thanks, Shaun


    Monday, June 16, 2014 9:08 AM