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)

Move a new field from Sales Header to Sales Invoice Header when posting, using new Development Environmet

(0) ShareShare
ReportReport
Posted on by 166

Hello Lads!

I have the following code from one of my extensions test, for Visual Studio Code in the new Development environment for Dynamcis NAV 2018:

------

tableextension 50110 AdditionalCommentsExtension extends "Sales Header"
{
    fields
    {
        field(50110;AdditionalComment1;Text[100])
        {
            CaptionML = ESM = 'Comentarios Adicionales', ENU = 'Additional Comments';

            trigger OnValidate();
            begin
                if (rec.AdditionalComment1 <> '') then
                begin
                    Message('El Mensaje "%1" ha sido agregado al documento',rec.AdditionalComment1)
                end;
            end;
        }
        field(50111;AllowComments;Boolean)
        {
            CaptionML = ESM = 'Permitir Comentarios', ENU = 'Allow Comments';
            
            trigger OnValidate();
            begin
                if (rec.AllowComments = true) then
                begin
                    Message('Ahora se pueden agregar comentarios')
                end else if (rec.AllowComments = false) then
                begin
                    Message('Ahora no se pueden ingresar comentarios')
                end;
            end;
        }
    }
}

tableextension 50111 AdditionalComment3 extends "Sales Invoice Header"
{
    fields
    {
        field(50110;AdditionalComment1;Text[100])
        {
            CaptionML = ESM = 'Comentarios Adicionales', ENU = 'Additional Comments';
        }
    }
}

pageextension 50110 AdditionalComment1 extends "Sales Order"
{
    layout
    {
        addlast(General)
        {
            field("Additional Comment 1";AdditionalComment1)
            {
                CaptionML = ESM = 'Comentario Adicional 1', ENU = 'Additional Comment';
                Editable = AllowComments;
            } 
            field("AllowComments";AllowComments)
            {
                CaptionML = ESM = 'Permitir Comentarios', ENU = 'Allow Comments';
            }
         }
    }
    actions
    {
        //add changes to actions in this section
        
    }
}

pageextension 50111 AdditionalComment2 extends "Sales Invoice"
{
    layout
    {
        addlast(General)
        {
            field("Additional Comment 1";AdditionalComment1)
            {
                CaptionML = ESM = 'Comentario Adicional 1', ENU = 'Additional Comment';
                Editable = AllowComments;
            } 
            field("AllowComments";AllowComments)
            {
                CaptionML = ESM = 'Permitir Comentarios', ENU = 'Allow Comments';
                
            }
        }
    }
}

pageextension 50112 AdditionalCommentOnPosted extends "Posted Sales Invoice"
{
    layout
    {
        addlast(General)
        {
            field("Additional Comments";AdditionalComment1)
            {
                CaptionML = ESM = 'Comentario Adicional 1', ENU = 'Additional Comment';
                Editable = false;
            }
        }
    }
}


------

Well then, basically I have 2 new fields on my Sales Header Table, and related to the pages for Sales Order and Sales Invoice; and therefor I have the field "Additional Comment" on Sales Invoice Header, and being shown on Poste Sales Invoice Page.

But I haven't been able to get the proper way to modify or create any procedure to take the value on field 'Additional Comment' on Sales Header, and write it on Sales Invoice Header when the document is Posted. 

Can anyone please assist on it?

Thank you in advance!

*This post is locked for comments

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

    So what is happening when you have value on the sales header on post the order/invoice, does the value does not transfer to sales invoice header?

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)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans