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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Undefined error

(0) ShareShare
ReportReport
Posted on by 5,514

4338.undefined.PNGHi, i am working on this issue from few days and could'nt able to solve this issue as today is last day to submit.. i added all the fields correctly my code have no error still i am getting error.. please help me out to figure out

*This post is locked for comments

I have the same question (0)
  • Karsten Wirl Profile Picture
    4,477 on at

    Hi sandeepc.

    Your environment has problem with the specified element (variable, method, function...). Please verify your source code und check the onload event handler.

  • sandeepc Profile Picture
    5,514 on at

    function BuisnessHourtooktocompletetask_onload()

    {

    alert("Test");

    var stdate=Xrm.Page.getAttribute("new_starttime").getValue();

    var endate=Xrm.Page.getAttribute("new_endtime").getValue();

    if(stdate==null && endate==null)

    {

    alert("Please enter the Start Time / Finish Time…");

    return false;

    }

    if(stdate==null)

    {

    alert("Please enter the Start Time !");

    return false;

    }

    if(endate==null)

    {

    alert("Please enter the Finish Time !");

    return false;

    }

    var st=stdate.getTime();

    var ed=endate.getTime();

    var sdiff=(ed-st);

    var Buisness hour took to complete task=(sdiff/60/1000);

    var p=parseInt(h);

    var tm=p.toString();

    Xrm.Page.getAttribute("new_buisnesshourtooktocompletetask").setValue(tm);

    }

    // Avoid `console` errors in browsers that lack a console.

    (function() {

       var method;

       var noop = function () {};

       var methods = [

           'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',

           'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',

           'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',

           'timeStamp', 'trace', 'warn'

       ];

       var length = methods.length;

       var console = (window.console = window.console || {});

       while (length--) {

           method = methods[length];

           // Only stub undefined methods.

           if (!console[method]) {

               console[method] = noop;

           }

       }

    }());

    if(typeof console =="undefined")

    {

    this.console = {log: function() {}};

    }

    this is my code.. everything is fine i think

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

    Sandeep,

    Are you sure that your code has no errors?

    I see following lines and one of lines looks like an error (guess which one):

    var sdiff=(ed-st);

    var Buisness hour took to complete task=(sdiff/60/1000);

    var p=parseInt(h);

  • sandeepc Profile Picture
    5,514 on at

    so sdiff --should i need to add sdiff as field in crm form?

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

    No, you don't need. Error in other line.

  • Verified answer
    Oleksandr Klymenko Profile Picture
    40 on at

    Try to remove whitespaces from your variable name and you will be surprized..

  • Suggested answer
    Community Member Profile Picture
    on at

    HI,

                 Are there spaces in this variable?? "Buisness hour took to complete task" or just shown like this. Because there should be no spaces in the variable name.

    Best Regards

    Shah

  • sandeepc Profile Picture
    5,514 on at

    ok i will remove and will check

  • Suggested answer
    Nishant Rana Profile Picture
    11,325 Microsoft Employee on at

    We faced the similar issue couple of days back onload and specific function name being mentioned in the error dialog box.

    nishantrana.me/.../

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans