Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error while using js in developers tools.

(0) ShareShare
ReportReport
Posted on by

Hello All Experts,

i am writing below code in console of the developers tool in IE browser.

Xrm.Page.ui.controls.get(
function(ctrl,i){
 if(ctrl.getControlType() == "subgrid")
  console.log(ctrl.getName()
  );
});

but getting below error.
Unable to get property 'controls' of undefined or null reference.

*This post is locked for comments

  • Verified answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: Error while using js in developers tools.

    Hi,

    That's exactly it - when it's running in the form context then it's already in the right frame.

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: Error while using js in developers tools.

    Hello Scott,

    I think we need to explicitly select the frame when we try to debug using the developers tools, but when this script is in form itself then it doesn't required the frame to be select explicitly .

    am i correct on the above thought??

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Error while using js in developers tools.

    Hi,

    Please try registering a simple function as shown below in the form on load and once the debugger is hit, you navigate to console in developer tools and type this code. It will give you the required results.

    function TestDebugging(){
    debugger;
    }

    Hope this helps.

  • Verified answer
    ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: Error while using js in developers tools.

    This is usually because you need to select the correct target frame - rather than using the default top level.

    In the console window - select 'ClientAPIWrapper.aspx' in the 'Target' drop down on the top right.

    Hope this helps

  • Gee Bee Profile Picture
    Gee Bee 11,397 on at
    RE: Error while using js in developers tools.

    Hi

    What are you trying to do?

  • Suggested answer
    saadzag Profile Picture
    saadzag 1,145 on at
    RE: Error while using js in developers tools.

    Hello,

    Try using this shortcut:

    Xrm.Page.getControl 

    See https://msdn.microsoft.com/en-us/library/gg334266.aspx

    Saad

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