Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Request message has unresolved parameters

  • 1.  Request message has unresolved parameters

    Posted 26 days ago
    Edited by Joseph Thiel 26 days ago
    This error message has mysteriously begun to appear in our Development environment, but thankfully not elsewhere:  "Request message has unresolved parameters."  It happens when we click a custom button that calls an Action in our plug-ins.  Nothing has changed about the custom button or action; unrelated code in the plug-in has been changed and uploaded several times.  The trace log just displays the same message with a lengthy stack trace that doesn't mention anything recognizable.  Logging code added inside the plugin never runs, because the plugin presumably never starts.  Nothing appears in the server's Event Viewer (this is D365 on-premise).  I've inspected the configuration of the ribbon button and its command (using Ribbon Workbench 2016), the Javascript it calls, and of course the C# code in the action plugin itself.  There are similar plug-ins, both on our Development and Production server, which are still working; I've compared them in every way I can think of, and they all appear to be configured correctly.  And my Internet search only seems to yield solutions that don't make any sense to me, at least not as worded.  At this point, I am left blaming the coronavirus.  Please help!

    #Technical #OnPremise #D365
    ------------------------------
    Joseph Thiel
    Software Engineer
    Per Mar Security
    Davenport IA
    ------------------------------
    ​​​​​​​


  • 2.  RE: Request message has unresolved parameters

    Posted 25 days ago
    Could you add the trace here.

    ------------------------------
    Linet Preshma Pereira
    Senior Technical Consultant
    Infinite Computing Systems, Inc
    Dallas, Texas
    ------------------------------



  • 3.  RE: Request message has unresolved parameters

    Posted 25 days ago
    Have you debugged the javascript and verified the parameters are getting passed to the custom action?

    ------------------------------
    Scott Sullivan
    Protective Life Insurance Company
    Birmingham AL
    ------------------------------



  • 4.  RE: Request message has unresolved parameters

    Posted 24 days ago
    Thank you both for your replies.
    Also, Scott, thank you for reminding me I could at least add debugging code to the javascript to get some clues.  However, I've spent the whole workday just trying to get the javascript to throw me some Alert messages to show what's going on.
    First, the aforementioned custom button mysteriously stopped appearing on the CRM form--even after I deleted its Display condition.  I couldn't get it back until I deleted and re-created the Command (in Ribbon Workbench 2016).
    When I finally got that working, the javascript was mysteriously not running as expected.  Long story short, after playing with the Alert messages I could generate, I discovered that apparently the two relevant javascripts (utilities.js and ribbon.Quote.js) are not loading in the correct order.  The ribbon.Quote.js code is running, but it references a function in the utilities.js script, and I got it to explain that those function(s) don't exist at that point in the code, which tells me that utilities.js has not run yet.
    Here's the odd thing.  It looks like something is already in place that should've remedied that, but isn't.  In Ribbon Workbench, the Command for this button has two Custom Javascript Actions.  The first one calls utilities.js for function "isNaN".  I think I see why they (the 3rd party coders) did that.  There's no function "isNaN" in utilities.js, but by doing that, I believe they were trying to force utilities.js to load first, so it would be in memory when the second Javascript Action (the important one) runs.  But somehow that's not working anymore....?
    I apologize that this problem has taken a different direction from my original post.  If I can ever get "back" to the point where I can get Javascript Alert messages AND trace my original message, I'll let you know.
    By the same token, Preshma, I didn't save a copy of the trace log, and will have to get the code back to that point before I can post it as you requested.

    Again, thank you both for your help.


    ------------------------------
    Joseph Thiel
    Software Engineer
    Per Mar Security
    Davenport IA
    ------------------------------



  • 5.  RE: Request message has unresolved parameters

    Posted 22 days ago
    Followup:  The problems have been fixed.  The bizarre Javascript behavior, custom button behavior, and (apparently) even the original "Request message has unresolved parameters" were caused by the same thing:  There was a major bug in utilities.js.  I never actually saw it, but corrected it by rolling back to a much earlier version of utilities.js and then carefully adding only the changes I couldn't do without.  It was the kind of bug that wouldn't be caught by "Intellisense", but probably blew up while it was being executed...say, a mismatch between what the calling .js expected and what utilities.js provided.  Once I uploaded the corrected version to D365, not only did the unusual Javascript behavior go away (described in my 2nd message) but the original "request message" error vanished as well; so it seems they were all related.

    Details:  The bottom line is that I finally remembered Javascript has a nasty habit of just....quitting, when it doesn't like something:  No error messages, no logs, no warnings, it just gives up.  The way everything was configured to pre-load utilities.js, but utilities.js was suddenly and mysteriously missing despite the pre-loading, reminded me of that behavior.  I got one script to work by cutting and pasting utilities.js at the top of it; but when I discovered other ribbons and forms doing the exact same thing, I realized something must have gone haywire with the content of utilities.js itself.

    Thanks again for your help.  I hope this description helps clear up this problem for you if you should ever face this error.  :)



    ------------------------------
    Joseph Thiel
    Software Engineer
    Per Mar Security
    Davenport IA
    ------------------------------



  • 6.  RE: Request message has unresolved parameters

    TOP CONTRIBUTOR
    Posted 22 days ago
    You might want to consider creating a "Wrapper" Function in your Utilities.js to try and catch the error in the Function and write the error to a Custom Error Log Table.  Not only will you be trapping the Error, you will be logging it.  More often than not, Users will not report to you errors in your Code. A simplified version of the JS would be (Using my shortened JS formatting):

    function xxxCallFunction(functionname, displayerror, halt, fnparams)  {
    // filename is the js file where the function resides, displayerror and halt are true or false
    var fn = window[functionname];
    var returnvalue;

    try {
            if (typeof fn === "function") {
                if (fnparams === null || typeof fnparams === "undefined") {
                    // Call function with no Parameters attached
                    returnvalue = fn.apply();
                 } else {
                       // Call function with Parameters attached 
                    returnvalue = fn.apply(null, fnparams);
                 }
            } else {
                  // Name provided was not a function
                 throw new Error(functionname + " is not a Function");
            }
    } catch (Ex) {
            if (!Ex.hasOwnProperty("functionname")) {
                // Add the filename to the Error Object
                Ex.functionname = functionname;
            } else {
                 // May apply for nested Call Functions
                Ex.functionname = Ex.functionname + ": " + functionname;
            }

            var DisplayMsg = "An error occurred in the function: " + functionname + ".";
            if (displayerror === true) {
                // Display the error if true
                ltfAlert(DisplayMsg);
            }
                  if (halt === true) {
                        // Stop the function from continuing if true
                        throw Ex;
                  }

          // Write the Error to the ErrorLog table in CRM
          reportErrorAndWriteToLog(false, Ex, DisplayMsg);
        }
        return returnvalue;
    }


    ------------------------------
    Gerry Yurko
    CRM Developer
    Crown Castle Fiber Networks
    Boxborough MA
    ------------------------------



  • 7.  RE: Request message has unresolved parameters

    Posted 22 days ago
    Intriguing.  As a precaution, I've already gone through utilities.js and wrapped each function individually in a try-catch block, which is rather tedious as you might guess.  I have some questions:
    1) Hypothetically, can your solution be installed permanently for multiple JS files, or should it only be used on one at a time, temporarily, for debugging?
    2) Wouldn't re-throwing the error with halt===true result in a cascade effect if it were used in multiple JS files and/or with nested function calls?
    3) What is an "ltfAlert"?  Google had zip about it.

    (I know we're a long, long way from the original topic by now, yet I feel all of this is publicly useful.  Should I be spinning it off into its own topic, or replying privately?)

    ------------------------------
    Joseph Thiel
    Software Engineer
    Per Mar Security
    Davenport IA
    ------------------------------



  • 8.  RE: Request message has unresolved parameters

    TOP CONTRIBUTOR
    Posted 21 days ago
    1) Hypothetically, can your solution be installed permanently for multiple JS files, or should it only be used on one at a time, temporarily, for debugging?

    Yes, this can be run multiple time over many JS Files.
    I am assuming your Utilities.js is added to each Form in addition to a JS with your Form-specific Code.

    In our Form-OnLoad JS we use it as a Roadmap of Function Calls

    • function Form_OnLoad() {
      • xxxCallFunction("ltfCommonOnLoad", "Utilities", false, false);
      • xxxCallFunction("InitializeFields", "frmOpportunity", true, false);
      • xxxCallFunction("OnChangeFields", "frmOpportunity", true, false); // Assign values to _Role
      • xxxCallFunction("SetUserRoles", "frmOpportunity", true, false); // Assign values to _Role
      • xxxCallFunction("EnableFieldsByRole", "frmOpportunity", true, false);
      • xxxCallFunction("EnableLocationStatusforSpecialRole", "frmOpportunity", true, false);
    • }

    2) Wouldn't re-throwing the error with halt===true result in a cascade effect if it were used in multiple JS files and/or with nested function calls?

    Potentially, I suppose.  It hasn't been a problem.

    We typically try not to nest xxxCallFunction calls, but if we do the error would "bubble up" to the originating Call

    3) What is an "ltfAlert"?  Google had zip about it.

    It's a naming convention of another function in that guarantees no other function in the Form would have that Function name
    I meant to remove the "ltf" which is an acronym of my former Company until we were bought out.

    When Microsoft deprecates code like Xrm.Page we don't have to refactor all of our lines of Code but just the unique Function Call
    For instance we have xxxSetValue(FieldName, FieldValue) as a function that essentially replaces Xrm.Page.getAttribute(FieldName).setValue(FieldValue);

    When it is time to replace Xrm.Page with frmCtrl (my naming convention for ExecutionContext) we only have to change Utilities.js
    We did this after the incredibly painful code refactoring of crmForm.all to Xrm.Page going from CRM 4.0 to CRM 201


    ------------------------------
    Gerry Yurko
    CRM Developer
    Crown Castle Fiber Networks
    Boxborough MA
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role