Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

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

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
    Suresh Kulla 43,745 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

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans