Microsoft.Dynamics.Nav.Runtime.INavRecordHandle is Unknown

Ravi_ThakkarRavi_Thakkar Member Posts: 392
edited 2009-07-09 in NAV Three Tier
Hello All,

I am working with NAV web services through VS 2008.
When I tried to execute one function of one codeunit of NAV published as a web-service, It got executed completely and after last line of function execution, I am gett9ing the following error:

"The type Microsoft.Dynamics.Nav.Runtime.INavRecordHandle is unknown."

Please help me if you have any idea.
Thanks.
Ravi_Thakkar
Ahmedabad, Gujarat, India
E Mail : ravi.thakkar@hotmail.com

Answers

  • ara3nara3n Member Posts: 9,255
    how did you find out that it's the last line?


    Also what kind of code are you executing?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Actually, By putting the ERROR messages I tested that code.
    Web Services are able to throw an error on web from NAV ERROR messages.

    So, I put, ERROR message in last line of my function.
    So, instead of showing "The type Microsoft.Dynamics.Nav.Runtime.INavRecordHandle is unknown." ERROR,
    It displayed, my ERROR message on web.

    So, I can come to know about the success of execution up to which line.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • ara3nara3n Member Posts: 9,255
    can you paste your code. Are you doing anything special with your code?
    I would like to replicate the issue.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Below is my function in NAV :

    ExpenseClaimedByEmployee(VAR PurchHeader_IRec : Record "Purchase Header")
    PurchHeader_IRec.TESTFIELD("Claim Status",PurchHeader_IRec."Claim Status"::Open);
    PurchHeader_IRec.TESTFIELD("Job No.");
    
    Resource_lRec.RESET;
    Resource_lRec.SETRANGE("No.",PurchHeader_IRec."Buy-from Vendor No.");
    IF Resource_lRec.FINDFIRST THEN
      Resource_lRec.TESTFIELD("Resource Group No.");
    
    UserSetup_lRec.RESET;
    UserSetup_lRec.SETRANGE("User ID",UPPERCASE(USERID));
    IF UserSetup_lRec.FINDFIRST THEN
      UserSetup_lRec.TESTFIELD(UserSetup_lRec."Employee No.")
    ELSE
      ERROR(Text0033,USERID);
    Purchline_Lrec.RESET;
    Purchline_Lrec.SETRANGE("Document Type",Purchline_Lrec."Document Type"::Invoice);
    Purchline_Lrec.SETRANGE("Document No.",PurchHeader_IRec."No.");
    IF Purchline_Lrec.FINDSET THEN
      REPEAT
        IF Purchline_Lrec."Requested Amount" = 0 THEN BEGIN
          Flag_Lbool := TRUE;
          ERROR(Text0023);
        END;
        Purchline_Lrec."Manager Approved Amt" := Purchline_Lrec."Requested Amount";
        Purchline_Lrec.MODIFY;
      UNTIL (Purchline_Lrec.NEXT = 0) OR Flag_Lbool;
    PurchHeader_IRec."Claim Status" := PurchHeader_IRec."Claim Status"::"Pending Approval";
    PurchHeader_IRec."Document Date" := WORKDATE;
    PurchHeader_IRec.MODIFY;
    ApprMgt_gCdu.InsertApplApprovalEntry(PurchHeader_IRec);
    ERROR('ABC');
    

    It is giving me the result in exception : ABC
    That means successful execution of whole function up to ERROR('ABC') stmt.

    If i am not putting the ERROR('ABC') stmt then it is showing me the error
    Microsoft.Dynamics.Nav.Runtime.INavRecordHandle is Unknown

    Can you help me?
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    What if you remove the VAR on the parameter?
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    I have used this codeunit function as an extension codeunit due to my need of Record Variable as a parameter.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    Yes, but your function is declared with a VAR parameter:

    ExpenseClaimedByEmployee(VAR PurchHeader_IRec : Record "Purchase Header")

    This probably means that Webservices will see this as a function taking a Record as parameter (which in your C# method is a key) and returning a Record - which cannot be done - there you have it.

    I am just guessing here - haven't tried it.
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hi Freddy,

    Thanks for your response.
    I think you may be right.
    I have used the Function Parameter as a Pass By Reference. I will try to change it and try to do that. Will revert back.

    Thanks.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Yes Freddy.
    You were right.

    Actually I had one Variable as a Parameter which was a "Pass By Reference Variable".
    I changed the logic and removed that variable and it worked.

    Thanks.
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
Sign In or Register to comment.