Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

(0) ShareShare
ReportReport
Posted on by 115

I am trying to open the lookup dialog on click of a button using the following syntax,

Xrm.Utility.lookupobjects(lookupoptions).then(successcallback,cancelcallback)

I am getting a 'LookupObjectsWithCallback is undefined' error , is this not supported in v9.0 ? or am i missing something ?

Thanks in advance

*This post is locked for comments

  • Robert_K Profile Picture
    25 on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    Hi wisleans, how implements this in a form. I want to use this without implement this in a custom htm webresource.

    In new UI it's working fine:

    var lookupOptions = {

       defaultEntityType: "account",

       entityTypes: ["account","contact"],

       allowMultiSelect: true,

           disableMru: true,

       filters: [

               {

           filterXml: "<filter type='and'><condition attribute='name' operator='eq' value='A. Datum Corporation' /></filter>",

           entityLogicalName: "account"

           },

               {

           filterXml: "<filter type='and'><condition attribute='lastname' operator='eq' value='Glynn' /></filter>",

           entityLogicalName: "contact"

           },

           ]

    };

    Xrm.Utility.lookupObjects(lookupOptions)

       .then(function(result){

       console.log(result);

       });

    old ui:

    you get Uncaught ReferenceError: LookupObjectsWithCallback is not defined

  • Community Member Profile Picture
    on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    This is because lookup.js from Microsoft is not available at your content level. Make sure your code is being called from correct hierarchy level

  • Community Member Profile Picture
    on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    [quote user="SR"]

    I am trying to open the lookup dialog on click of a button using the following syntax,

    Xrm.Utility.lookupobjects(lookupoptions).then(successcallback,cancelcallback)

    ...

    [/quote]

    Probably just a typo in your post but the method is called lookupObjects rather than lookupobjects.

    Ref. docs.microsoft.com/.../lookupobjects

  • Community Member Profile Picture
    on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    Did you solve this?  I am getting the same error and doing something very similar to you.

  • Community Member Profile Picture
    on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    For V9+, you are correctly using: Xrm.Utility.lookupObjects (rather than "unsupported" LookupObjectsWithCallback).

    Ref. docs.microsoft.com/.../lookupobjects

    LookupObjectsWithCallback is used in CRM2011 and CRM365 V8.2 and earlier to implement similar functionality.  Are you sure the error came from your code and not similar, older code? If so,  judging by your error, I expect Microsoft (or somebody else) implemented lookupObjects using LookupObjectsWithCallback() but that does not explain why it cannot be found.  FYI We normally access LookupObjectsWithCallback() through the crmWindow:

    var crmWindow = Xrm.Internal.isTurboForm() ? parent.window : window;
    
    crmWindow.LookupObjectsWithCallback(...etc....);
  • Suggested answer
    Shaminderpal Singh Profile Picture
    1,565 on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    Are you attaching your html web resource to entity form or opening it as a stand alone page?

    Also, would it be possible for you to share your web resource naming convention to help determine the source of referenced script?

    Web Resource Naming - new_lookup.js (without any folder structure)

    Below Code is working for me :

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title></title>
    <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
    <script src="../_static/_controls/lookup/lookup.js"></script>
    <script>
    function lookupclick() {
    Xrm.Utility.lookupObjects({
    allowMultiSelect: false,
    defaultEntityType: 'contact',
    defaultViewId: 'A2D479C5-53E3-4C69-ADDD-802327E67A0D',
    entityTypes: ['contact']
    }).then(function (success) {
    console.log('Captured Response', success);
    }, function (cancel) {

    });
    }

    </script>
    </head>
    <body>
    <button id="lookup" onclick="lookupclick()">Lookup</button>

    </body>
    </html>

    Hope it helps.

    -Shaminder

  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    This ../../../../ depends on your name (folder structure) of web resource. It may have extra or less depends on your project.

    You have to add more details rather than one line responses. You have to try something & share what are all you tried.

  • Sumisrinivasan Profile Picture
    115 on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    I am getting the same error even after adding the reference

  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    If you would have followed the link I shared earlier - you can double check whether you have added this script file reference in your HTML web resource.

    <script src="../../../../_static/_controls/lookup/lookup.js"></script>

  • Sumisrinivasan Profile Picture
    115 on at
    RE: 'LookupObjectsWithCallback' is undefined - show lookup dialog v9.0 error

    I am using window.parent when calling it from html web resource , i get the same error . I don't think that is causing this error .

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
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans