Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

ReferenceError: 'namespace' is undefined at eval code (eval code 1:1)

Posted on by

I am getting below error while loading email for in IE.  Same code, form is working fine in Chrome for email load. In fact the similar code is working is working fine on other entities.

FYI: I am on Dynamics 365 9.0.2 and not using Legacy form render.

How can I resolve it?

ReferenceError: 'po' is undefined
at eval code (eval code:1:1)
at RunHandlerInternal (xyz.crm.dynamics.com/.../ClientApiWrapper.aspx)
at RunHandlers (xyz.crm.dynamics.com/.../ClientApiWrapper.aspx)
at OnScriptTagLoaded (xyz.crm.dynamics.com/.../ClientApiWrapper.aspx)
at Anonymous function (xyz.crm.dynamics.com/.../ClientApiWrapper.aspx)

6505.Email-Error.jpg

Sample code: 

if (typeof(po) == "undefined") {
    po = {
        __namespace: true
    };
}
if (typeof(po.Library) == "undefined") {
    po.Library = {
        __namespace: true
    };
}
if (typeof ($) === "undefined") {
    $ = parent.$;
    jQuery = parent.jQuery;
}
 
po.Library.Email = {
    LoadForm: function () {
// logic goes here.
}
    __namespace: true
};

*This post is locked for comments

  • Suggested answer
    Vipin J Profile Picture
    Vipin J 1,583 on at
    RE: ReferenceError: 'namespace' is undefined at eval code (eval code 1:1)

    Please also check if you are passing parameter without single quote.

    CRM is expecting parameter to be in single quotes.

    This happens with us when we migrated from CRM 2011 to CRM 2016

  • Suggested answer
    RE: ReferenceError: 'namespace' is undefined at eval code (eval code 1:1)

    Never mind, I find the solution for this problem.  I was not a javascript error, it was not a syntax error. Just how IE is going to handle a syntax or function.

    I have one function on Onload or entity.  The way, this function was defined was defined was differnet.

    Let's say:

    if (typeof(po) == "undefined") {

       po = {

           __namespace: true

       };

    }

    if (typeof(po.Library) == "undefined") {

       po.Library = {

           __namespace: true

       };

    }

    if (typeof ($) === "undefined") {

       $ = parent.$;

       jQuery = parent.jQuery;

    }

    po.Library.Email = {

       LoadForm: function () {

           po.Library.Email.callFaultySignaturefunction(); // This will not work in IE, but work in Chrome and was causing issue.

           po.Library.Email.callfunctionwithCorrectSignature(); // This works fine.

    },

    callFaultySignaturefunction(){

    },

    callfunctionwithCorrectSignature : function()

    {

    },

       __namespace: true

    };

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans