web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Custom mod for posting

(0) ShareShare
ReportReport
Posted on by

Hi,

I am making a solution for subscription to be get into GL account over different periods. This is 2013 verision, and i noticed they have built it in the newer versions of NAV.

I have created a codeunit that creates a General Journal and fill lines up and post it. It works fine - but I am in question were to put this function to trigger.

The functions have following parameters - Amount (from sales line), Date(for when posting should start), Period(over how many months). Maybe information from header would be nice aswell so i can write the invoice no. in the description.

When the client is making a sale they are using G/L Account - 01325, So i am only interrested in when they make a sales with type GL Acc.

I have looked at codeunit 80 - it seemed like a good place to add my function, but there are many thousands of lines to place it. Do you have any suggestions?

Thanks in advance

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Suresh Kulla Profile Picture
    50,245 Super User 2025 Season 2 on at

    You can add the code after posting customer entries, search for Post customer Entry, try to add the code after the line

    PostICGeenJnl.

  • Suggested answer
    Yogesh Kulkarni_ Profile Picture
    1,762 on at

    Hello Christopher,

    You can call your custom CodeUnit after posting of Balance Entry in Balance Account.

    Please search for "PostBalanceEntry" function in Invoicing and call your CU from there in Sales-Post CU.

    -Yogesh Kulkarni

    Please verify, if you find answer helpful.

  • Community Member Profile Picture
    on at

    Suresh Kulla thanks. I have insertet my code where you suggested. My code looks like this where i insertet it after the PostICGenJnl.

       IF Invoice THEN
        IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice] THEN BEGIN
          CASE SalesLine.Type OF
            SalesLine.Type::"G/L Account":
              IF (SalesLine."No." <> '') AND NOT SalesLine."System-Created Entry" THEN BEGIN
                  CollTypeMeMa.SETRANGE(CollTypeMeMa."G/L Account",SalesLine."No.");
                  IF CollTypeMeMa.FINDFIRST THEN BEGIN  
                      CHOCU.Foo(SalesHeader."External Document No.",SalesLine."Amount Including VAT",SalesLine."From date",12,SalesLine."No.",CollTypeMeMa."Period Account",'01325');
                  END;
              END;
          END;
        END;

    ]

    I get this error and understand why it happens, but can I get around it without using a COMMIT? 

    post.PNG

    Thanks in advance

  • Suggested answer
    Suresh Kulla Profile Picture
    50,245 Super User 2025 Season 2 on at

    What is the code it is executing in this function 

    CHOCU.Foo
  • Community Member Profile Picture
    on at

    http://pastebin.com/GZF6gVyr

  • Verified answer
    Suresh Kulla Profile Picture
    50,245 Super User 2025 Season 2 on at

    In your code you are using TryGetNextNo of NoSeriesMgt which is causing that error try to use GetNextNo function instead of TryGetNextNo function and hopefully that should solve your issue.

  • Community Member Profile Picture
    on at

    Thanks @Suresh Kulla it works.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans