locked
CRM 2011 - Using advanced find to filter leads for multiple 'contains' entries RRS feed

  • Question

  • Hi all,

    I am trying to filter a leads list by email address.  I want to query the leads list to see if any email addresses contain a certain domain.  How can I add multiple domain names to the 'contains' field.  Is there a separator to use for or?  I have hundreds to check so don't want to add each line by line.

    Thanks!

    Friday, August 7, 2015 2:26 PM

Answers

  • Hello,

    The only way is to use OR statement like:


    Dynamics CRM MVP
    My blog

    Friday, August 7, 2015 2:52 PM
    Moderator
  • Yes, fetch would work. It will look like following:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="lead">
        <attribute name="fullname" />
        <attribute name="companyname" />
        <attribute name="emailaddress1" />
        <filter type="and">
          <filter type="or">
            <condition attribute="emailaddress1" operator="like" value="%@gmail.com%" />
            <condition attribute="emailaddress1" operator="like" value="%@live.com%" />
          </filter>
        </filter>
      </entity>
    </fetch>

    And you can add many domains for check inside. Not sure regarding the number of conditions you can put inside filter.


    Dynamics CRM MVP
    My blog

    Friday, August 7, 2015 3:13 PM
    Moderator

All replies

  • Hello,

    The only way is to use OR statement like:


    Dynamics CRM MVP
    My blog

    Friday, August 7, 2015 2:52 PM
    Moderator
  • Can you use the fetchXML to build out the entire list? I'm not familiar with building XML queries but it seemed like a possibility?
    Friday, August 7, 2015 3:05 PM
  • Yes, fetch would work. It will look like following:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="lead">
        <attribute name="fullname" />
        <attribute name="companyname" />
        <attribute name="emailaddress1" />
        <filter type="and">
          <filter type="or">
            <condition attribute="emailaddress1" operator="like" value="%@gmail.com%" />
            <condition attribute="emailaddress1" operator="like" value="%@live.com%" />
          </filter>
        </filter>
      </entity>
    </fetch>

    And you can add many domains for check inside. Not sure regarding the number of conditions you can put inside filter.


    Dynamics CRM MVP
    My blog

    Friday, August 7, 2015 3:13 PM
    Moderator
  • I think I have over 400 domains to check but will see if I can get it to work.  Can always split the queries up if we hit a limit.

    Thanks!

    Friday, August 7, 2015 3:18 PM