0

I have a query that starts at the QueueItem and, if the entity that Queue Item references is an E-mail, adds some additional filter conditions. One of those conditions is the primary field value of whatever that e-mail, in turn, is "Regarding". I don't really care what type of entity the E-mail references, I just need to allow the user to filter by the "Name" of that entity. Is this possible, and if so, how?

KeithS
  • 70,210
  • 21
  • 112
  • 164

1 Answers1

0

This depends somewhat from where the query is performed from.

With a basic FetchXML query, in around about sort of a way this is possible, you need to do joins on the relationship and see if there is a record there. Its not perfect but it might work.

enter image description here

If you are running the query from code, then its a bit easier as you can examine the entity type in code. For example:

EntityReference e = entity.GetAttributeValue("regardingobjectid");
string entityName = e.LogicalName;
James Wood
  • 17,286
  • 4
  • 46
  • 89
  • 1
    Advanced Find will check all conditions at once, it will never match – Alex Oct 28 '15 at 10:10
  • Good point, outer joins might help, somewhat hard to say as its not clear what the OPs full usage scenario is, https://msdn.microsoft.com/en-gb/library/dn531006.aspx – James Wood Oct 28 '15 at 10:34