Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Error while saving codeunit

Posted on by Microsoft Employee

Dear Experts,

I have created new code unit. while saving giving an error. Please advise

4048.error.png

Thanks

With Regards

Mandeep Kaur

*This post is locked for comments

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Error while saving codeunit

    [quote user="Binesh Singh Rajput"]

    You know what, The main issue is, you are not reading carefully solutions, Just once read what members suggested you.

    check my first solution's screenshot and as it is create.

    [/quote]

    Check the screenshot again Mandeep

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error while saving codeunit

    Hi All,

    Thanks for your support and help. 

    That error has been resolved. Now getting an error in Save Report function. Please advise.

    var.png

    Thanks

    With Regards

    Mandeep Kaur

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Error while saving codeunit

    Hello Mandeep Kaur,

    You know what, The main issue is, you are not reading carefully solutions, Just once read what members suggested you.

    check my first solution's screenshot and as it is create.

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Error while saving codeunit

    No need to add Userid in parameters.

    its a default function available.

    and reportid must be of type integer not record.

    check Binesh's screenshot.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error while saving codeunit

    Hi Binesh,

    As suggested, I have added ReportID and UserID into function parameter. But still getting error. please advise.

    Compile Error

    5722.variables.png

    Variables

    5722.variables.png

    Thanks

    With Regards

    Mandeep Kaur

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Error while saving codeunit

    Hello Mandeep,

    You declared ReportID and UserID variable as a Record variable, that are wrong.

    Delete both variables, and ReportID pass as a parameter in AddReport function.

    Save your codeunit then compile.

    Now its working.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error while saving codeunit

    Hi Saurav,

    I am trying this code in 2013r2  and the process is same which I am applying. Kindly advise please.

    Thanks All

    Mandeep Kaur

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error while saving codeunit

    Yes, You are right Binesh, I have created record variables.

    Please find below screenshot for same. Variables and code. Please advise.

    report-prop.png

    variables.png

    2234.code.png

    report-prop.png

    Thanks

    With Regards

    Mandeep Kaur

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 17,965 Super User 2024 Season 2 on at
    RE: Error while saving codeunit

    Hi,

    If i am not wrong you are trying to create a tool which will log report usage -

    Two Things -

    1. Error is because there is an integer variable which is not declared correctly.

    2. If you looking for tool for NAV 2016 Refer here -

    saurav-nav.blogspot.in/.../microsoft-dynamics-nav-2016-save-report.html

    In the same article there is a link to download tool for previous version.

    Hope it helps.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Error while saving codeunit

    In your code when you used User ID it should be USERID without any space.

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans