Hi
I am trying to write this field from Sales line to the another table called Accommodation the field is "Documant Type" "documant No." "Line No."
and then give "No series" to fourth field called "No." i write the follwing code to do this
In the salse line Form i add button and write the following code in onPush event
Call function called InsertAccom take the prameter Rec
Accommodation.InsertAccom(Rec);
FORM.RUN(FORM::"Accommodation Card",Accommodation);
and this is the code in the function InsertAccom this function take parameter (VAR salesLIne : Record "Sales Line")
InsertAccom(VAR salesLIne : Record "Sales Line")
INIT;
"Documant No." :=salesLIne."Document No.";
"Documant Type" :=salesLIne."Document Type";
"Line No.":=salesLIne."Line No.";
INSERT(TRUE);
and in the on insert triger write the following cade to give the "No. serise"
to filed "No."
IF "No."='' THEN BEGIN
TravelSetup.GET;
TravelSetup.TESTFIELD(TravelSetup."Accommodation No." );
NoSeriesMgt.InitSeries(TravelSetup."Accommodation No.","No. Series",0D,"No.","No. Series");
END;
The problem is that when i select seles line from the sales order and press
the button every thing goes right New Rec was Inserted in the Accommodation Table And Take New No." but if i select another sales line and press the button this line take the same "No." of the previous Rec
Unless I close The sales order Form and open it again
and then select sales line and press the button in this case the New Accommodation Rec take New" No."
Comments
there?
Use CLEAR instead of INIT. Or maybe RESET, but I always use CLEAR...
in the C/AL help of INIT:
[/quote][/code]
Do It Yourself is they key. Standard code might work - your code surely works.
RIS Plus, LLC
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
you are right the Problem is the INIT and clearing PK.
now its working thamk alot
dear DenSter the button is on the sales line not in the header
RIS Plus, LLC