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

  • Suggested answer
    Suresh Kulla Profile Picture
    47,688 on at
    RE: Move a new field from Sales Header to Sales Invoice Header when posting, using new Development Environmet

    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans