Check if a record has N:N relationship RRS feed

  • Question

  • Given the guid of an entity and the name of the N:N relationship, I need to know how to check if it has any N:N relationships. I know how to retrieve all N:N relationships, but it gives an error for those guids that don't have any relationships. How to check if it has associated records?

    Note that I have only one Guid and the relationship name. I need to know if it has any N:N relationship to any other record.


    • Edited by IamaNovice Sunday, September 29, 2013 8:20 PM
    Sunday, September 29, 2013 8:16 PM


  • Hi,

    Try this fetchxml query

      <entity name='systemuser'>
        <link-entity name='teammembership' from='systemuserid' to='systemuserid' visible='false' intersect='true'>
          <link-entity name='team' from='teamid' to='teamid' alias='ai'>
            <filter type='and'>
              <condition attribute='name' operator='eq' value='{guid here}' />

    Kids don't try this at home!

    • Marked as answer by IamaNovice Thursday, October 10, 2013 4:41 PM
    Wednesday, October 2, 2013 3:55 AM