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