web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Active Discussion

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

  • Sreevalli Profile Picture
    3,264 on at

    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>

  • Santosh Kulkarni Profile Picture
    235 on at

    Thanks Sreevalli for reply!

    I tried this but no luck...

  • Loic Orue Profile Picture
    927 on at

    Hi Santosh,

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

    Best Regards,

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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

    Hi Aric,

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

  • Varun Singh Profile Picture
    943 on at

    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.

  • tnunnenkamp Profile Picture
    5 on at

    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.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello guys,

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

  • Pavan Deepala Profile Picture
    90 on at

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans