Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Parameters

Posted on by Microsoft Employee

I'm trying to pass a parameter from my Page to my code unit. 

I have declared the function 'SalesShipmentAssignaBatch' with the parameter (recSalesShipmentLine : Record "Sales Shipment Line"). I have passed the local variables into the function. 

How ever when I attempt to save the code I get this Error Message(see below) 

Any feedback would be appreciated. If you want any other information please ask

8562.8.PNG3386.5.PNG3386.6.PNG6011.7.PNG

*This post is locked for comments

  • Verified answer
    RE: Parameters

    Hey Lewis,

    Its that you called a function which shouldn't have any parameters (a.k.a 0 parameters) but you have called it with parameters. So again, click OK on the error message and system will take you to the line which the error occured.

    Hope it helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parameters

    Thank you for your help! One last thing haha I'm Getting this error now 
    1031.12.PNG

    I'm sorry for being stupid, It's one of those days 

  • Suggested answer
    RE: Parameters

    Hi,

    If you have the same naming convention then the error isn't from this line. If you click OK on the error message, the system takes you to the line which you have the error. Do check is it the same line?

    Your code seems fine.

    Hope it helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parameters

    3808.11.PNGSorry that would of been me messing around. I currently do have them the same. 

  • Suggested answer
    RE: Parameters

    Hi,

    You have missed the spelling I guess.

    6242.4111.9.PNG

    6242.4111.9.PNG

    You created the function in the name of SalesShipmentAssignaBatch on codeunit and calling it as SalesShipmentLineAssignaBatch on the page. It's a clear mismatch. Rather than typing out the functions/variable, hit F5 and select from the C/AL Symbol Menu.

    Hope it helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parameters

    1538.10.PNG

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parameters

    4111.9.PNG

  • Suggested answer
    RE: Parameters

    Hi,

    If you are consuming the codeunit in the page, you have to declare it in that page's C/AL Globals. Attach screenshot(s) of the error please if it still persists?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parameters

    Oddly enough I have already done this. I'll try re adding it

  • Suggested answer
    RE: Parameters

    Hi,

    You have to declare the codeunit as a variable before using its function members.

    In your Development Environment,

    View -> C/AL Globals -> Variables Tab -> Click on a New line and Add the Codeunit.

    Name: As you want.

    DataType: Codeunit.

    SubType: Codeunit Object ID.

    Hope it helps.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans