Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Undefined error code

Posted on by 680

When the read only user is trying to  click on a ribbon button the user is getting the below error "Undefined error code [object object]". We debugged the javascript file and it was not happening because of any custom js code

.BUG_5F00_15249_5F00_undefined-error-code.jpg

*This post is locked for comments

  • Karthik Dayala Profile Picture
    Karthik Dayala 680 on at
    RE: Undefined error code

    Also we do not face this issue crm 2011 instance but only in 2016. The javascript code is same in both the environments. I have tried legacy form rendering too but it did not solve the issue.

  • Karthik Dayala Profile Picture
    Karthik Dayala 680 on at
    RE: Undefined error code

    The error was thrown in the dynamics script that crm generates ribbon.js.

  • Karthik Dayala Profile Picture
    Karthik Dayala 680 on at
    RE: Undefined error code

    var SendToPrintCenterOnClick = function ()

       {

           try

           {

               if(TEST.Helper.DisplayConfirm("Are you sure you want to send to print center?"))

               {

                   var MandatoryFieldBlankCounter = 0;

                   var attributes = TEST.Helper.GetAttributes();

                   for (var i in attributes)

                   {

                       if (attributes[i].getRequiredLevel() == "required" && attributes[i].getName() != "statecode" && attributes[i].getName() != "statuscode")

                       {

                           if (TEST.Helper.GetXrmControlValue(attributes[i].getName()) == null || TEST.Helper.GetXrmControlValue(attributes[i].getName()) == undefined)

                           {

                               MandatoryFieldBlankCounter++;

                               break;

                           }

                       }

                   }

                 if (MandatoryFieldBlankCounter == 0)

                 {

                  window.PluginTrigger = true;

                  TEST.Helper.SetXrmControlValue(TEST.Constants.Entity.CALL_ISSUE_FORM.PluginTrigger, (new Date().getTime() + Math.random()) + "");

                  Xrm.Page.data.save().then(

                                          function ()

                                          {

                                              TEST.Helper.NeverSubmitAllAttributes();

                                              _LoadCallIssueForm();

                                          },

                                       function (errorCode, message)

                                       {

                                           if (errorCode != undefined && errorCode != null)

                                           {

                                               TEST.Helper.DisplayMessage(message + " Error Code " + errorCode);

                                           }

                                           else

                                           {

                         TEST.Helper.DisplayMessage("An error occurred which prevents the save of the Call Issue Form.Please try the action again or contact CRM Support.");

                                           }

                                       }

                                      );

                  return true;

                 }

                 else

                 {

                   TEST.Helper.DisplayMessage("Please ensure all mandatory fields have data before you send to print center.");

                   return false;

                 }

             }

               else

               {

                   return false;

               }

           }

           catch(err)

           {

               TEST.Helper.DisplayAndWriteMessage("TEST.CallIssueForm.SendToPrintCenterOnClick()", err);

           }

       }; //end SendToPrintCenterOnClick

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