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 :
Small and medium business | Business Central, N...
Suggested Answer

Update purchase header "posting description" with the line first line similar to the G/L entry

(0) ShareShare
ReportReport
Posted on by 10
BC allows for us to carry the  line description to the General Ledger entry when posting. I would like to do similar but to the /Posting Description/. I know there is the code inthe Purchase Header:
    local procedure InitPostingDescription()
    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeInitPostingDescription(Rec, IsHandled);
        if IsHandled then
            exit;

        Rec./Posting Description/ := Format(Rec./Document Type/) + ' ' + Rec./No./;
    end;
 
 
 
What can I do before then to copy the first line description to the /Posting Description/ on the header? Is it creating a code unit event subscriber to the OnBeforeInitPostingDescription, or is there some other method?
 
Thanks,
 
I have the same question (0)
  • Suggested answer
    HVGEEL Profile Picture
    308 on at
    As you state correctly in your question: this is a HEADER function.
    In the header, things are rather straightforward: initialise the Psting Description to DocType + RecNo, allow the user to chage it afterwards.  End of story. Simple.
     
    If your requirement is to have the description of the first purchase line in the posting description, you will encouter a lot of issues along the way:
     
    - what if the first line gets deleted? Another line will become the first line and you will need to handle that
    - what if the Get ReceiptLines() function is called: in that case your first line will be a textline referring to a the first receipt on the invoice.
    - what if the first line is just a comment, and not a 'real' line: bottomline question: what do you consisder to be the first line?
     
    The only workable solution in my opinion is to determine the 'first line' in the Release() or Request Approval(depening on your setup) events.
    That of course will override the manual input the user has given.
     
    so I leave you with 2 questions:
    - what do you call the first line
    - how much work do you want to spend on coding the housekeeping for this?

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans