Hi all,
I'm trying to insert a new line into sales line with code below
No. - OnAfterValidate()
SL.RESET;
SL."Line No.":=GetLastLineNo(Rec."Document No.")+10000;
SL."Document Type":="Document Type";
SL."Document No.":=Rec."Document No.";
SL.Type:=Rec.Type;
SL."No.":='AAA';
SL.VALIDATE("No.");
SL.Quantity:=1000;
SL.VALIDATE(Quantity);
SL.INSERT;
CurrForm.UPDATE;
Everything is OK except the quantity of item AAA is not checked with inventory.
When i input quantity of AAA by manual, the system warning "Check Availability". But when i using code like above, the system not check inventory of item AAA.
How can I call validate quantity from another field.
Thanks for helping me.
Comments
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
1 - DO NOT give your variables these weird names. If you have a record variable into the Sales Line table, then call it SalesLine. It makes the code easier to read, less effort to troubleshoot, and all around better for everyone.
2 - you can directly assign a value while using VALIDATE, like this:
RIS Plus, LLC
I've checked the funtion CheckItemAvaible in Sales Line table. It'll run with current field no. But i can not call this function from form trigger "No." OnAfterValidate.
When I call
SL.CheckItemAvailable(FIELDNO("No."));
The system warning . ( SL is record Sales Line )
"You have specified an unknown variable. CheckItemAvailable"
How can i call this function from trigger OnAfterValidate of "No." field
http://www.BiloBeauty.com
http://www.autismspeaks.org
Yes. I want to call this function from form level because i just have permission on form. Not table.