Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

ConditionOperator.In example

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
    rajkm 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
    a33ik 84,323 Most Valuable Professional on at
  • Suggested answer
    Manoj Mane Profile Picture
    Manoj Mane 1,012 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans