Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Utility.lookupObjects filters not applying D365 CE

(0) ShareShare
ReportReport
Posted on by 235

Hi Friends,

I am trying to show the Lookup dialog using "Xrm.Utility.lookupObjects" but filter is not working.

I have web resource inside form, Now on button click i am showing lookup dialog with specific view, I want to further apply filter to the view. 

Below is code for reference:

var messageId = "{8C203514-6679-418g-77AD-16B52067LA96}"

var fetch = "<filter type='and'><condition attribute='kv_message' operator='like' value='" + messageId +"' /></filter>";

var encodedURL = encodeURIComponent(fetch).replace(/'/g, "%22");

var lookupOptions = {
defaultEntityType: "kv_message",
defaultViewId: "{7C203514-4879-418D-99AD-12B52067AC82}", // GUID of the View
viewIds: ["{7C203514-4879-418D-99AD-12B52067AC82}"], // GUID of the View
entityTypes: ["kv_message"],
allowMultiSelect: false,
disableMru: true
filters: { entityLogicalName: "kv_message", filterXml: encodedURL }   //Not working
};
parent.Xrm.Utility.lookupObjects(lookupOptions).then(function (returnValues) {
if (returnValues.length == 0)
return;

}, null);

how to apply filter to lookup dialog ?

how to show all the entities? ( apart from comma separated option)

Thanks!

just for reference lookup screen:

lookupobject.jpg

Regards,

Santosh

*This post is locked for comments

  • Pavan Deepala Profile Picture
    90 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Hi Santhosh,

    the filters is an Array of Objects . See the Example here https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utility/lookupobjects#example.

    Regards

    Pavan

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Hello guys,

    I understand that it's a bit late to answer the original question but you can find an answer here - butenko.pro/.../

  • tnunnenkamp Profile Picture
    5 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    I found that the filter breaks when allowMultiSelect is turned off. And I'm not sure if this makes a difference, but I did not use URI encoding on my filter xml.

  • Varun Singh Profile Picture
    941 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    HI Santosh,

    Did you get any solution for filters property of Lookup object. I have left a query with MS, I don't know when they will reply.

  • Loic Orue Profile Picture
    927 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Hi Aric,

    Sadly I already tried this as well, customFilters and customFilterTypes is not working (script won't even run if I use them).

  • Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Take a look at the following article:

    butenko.pro/.../microsoft-dynamics-365-v9-0-lookupobjects-closer-look

    Hope this helps.

  • Loic Orue Profile Picture
    927 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Hi Santosh,

    I'm facing the same issue here, did you ever manage to fix it?

    Best Regards,

  • Santosh Kulkarni Profile Picture
    235 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Thanks Sreevalli for reply!

    I tried this but no luck...

  • Sreevalli Profile Picture
    3,256 on at
    RE: Xrm.Utility.lookupObjects filters not applying D365 CE

    Hi Santosh,

    I think the lookup filed filer should be something like below try adding uiname and uitype to your filter.

     <filter type="and">     <condition attribute="msdyn_account" operator="eq" uiname="MigrationTest2" uitype="account" value="{67F600AB-7A51-E511-9444-00155D020C41}" />    </filter>

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans