Forums

Forums / Developing Portals / Lookup on an N:N relationship

Lookup on an N:N relationship

Thread is closed for posting
2 posts, 1 answered
  1. Marko Tsoi
    Marko Tsoi avatar
    1 posts
    Registered:
    10 Aug 2017
    09 Aug 2017
    Link to this post
    Hi,

    Is there a method to get a CRM lookup to look between an entity to another entity where there's a joining entity between them?

    Example:
    Contact has permissions on multiple accounts, as described in an account permissions entity.

    I can use a sub grid to see the connected accounts that the current contact has access to, but I cannot use the same fetch xml to see those accounts in a lookup. The lookup doesn't appear on the front end. 

    FetchXML from the subgrid: 
    <fetch version="1.0" mapping="logical" output-format="xml-platform">
      <entity name="uw_accountpermission">
        <attribute name="uw_accountpermissionid" />
        <attribute name="uw_subscriptionid" />
        <order attribute="createdon" descending="false" />
        <filter type="and">
          <condition attribute="statecode" operator="eq" value="0" />
        </filter>
        <link-entity name="uw_subscription" alias="uw_accountpermission671" to="uw_subscriptionid" from="uw_subscriptionid">
          <attribute name="uw_streetnumber" />
          <attribute name="uw_streetname" />
          <attribute name="uw_streettype" />
          <attribute name="uw_accountalias" />
        </link-entity>
      </entity>
    </fetch>

    The subgrid has a CRM dropdown whereas the lookup doesn't. I don't have enough knowledge of CRM to know if this is important or not. 

    Putting the same/similar fetch xml into the lookup gives me nothing, the lookup label, but no control, no dropdown. 

    Note: my actual fetchxml has a filter on current contact id. 
  2. Sonam Joshi
    Sonam Joshi avatar
    29 posts
    Registered:
    20 Mar 2017
    Answered
    01 Nov 2017
    Link to this post
    For this implementation, if the lookup field is pointing to the root entity it should work fine, in this case if the lookup field is point to accountpermission entity and not the subscription entity, it will work correctly.
2 posts, 1 answered