Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

ConditionOperator.In example

(0) ShareShare
ReportReport
Posted on by 65

Hi

  I need to import entityimage(byte array[]) from D365 CE Contact entity.

I need to bring all contacts with entityimageurl is not null.

I have imported contact entity to local sqldb using DES. I can see imageurl field but not entityimage field(byte array)

I have created console application which

1. Reads all contacts with entityimageurl IS NOT NULL  (stores all contactsid into an array)

2. The same contactid(s) I need to supply as filters to 

QueryExpression qe = new QueryExpression("contact");
qe.ColumnSet.AddColumns("contactid", "entityimage", "createdon", "modifiedon");
qe.Criteria.AddFilter(filter1);
qe.Criteria.AddFilter(filter2);
//qe.Criteria.AddFilter(filter2end); //used when using between dates and times
//qe.Criteria.AddFilter(filter3);

EntityCollection result = Service.RetrieveMultiple(qe);

How can I pass contacts array to QueryExpression?

In sql world, I need something like IN operator

Regards

Raj

  • rajkm Profile Picture
    65 on at
    RE: ConditionOperator.In example

    Hi Manoj Mane

    Thanks for the reply.

    If the query returns even 900 rows, I am getting error "Query timeout or max size limit of 208MB reached

    I thought of looping for each ContactId returned from sql query but I was told that it will send multiple requests to CRM and it may crash the live system.

    What is the alternate to return image(byte array) fields

    Thanks

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
  • Suggested answer
    Manoj Mane Profile Picture
    1,020 on at
    RE: ConditionOperator.In example

    Hi rajkm,

    You can refer the below query syntax.

    In this contacts is your array. 

    var
    queryExpression = contacts.map(contact => { return 'SELECT * FROM contacts WHERE firstName = "' + contact.firstName + '" AND lastName = "' + contact.lastName + '" AND
    phone
    Number = "' + contact.phoneNumber + '"'; });


    Thanks,
    Manoj Mane.

    Please mark this as VERIFIED if it helps. image


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans