Notifications
Announcements
No record found.
how to add or create a line in a form using x++ or functionality?
*This post is locked for comments
Hi Kavaljeet,
create a line in a form for Sales Order using x++
static void Esh_CreateSO(Args _args)
{
SalesId sid;
SalesLine sl;
sl.SalesId=sid;
sl.ItemId="A0001";
sl.InventDimId="000458";
sl.PriceUnit=3750.00;
sl.SalesQty=5;
sl.CreateLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);
info("Sales Order Created with Line");
}
thanks for the information and how can we do this with AOT Functionality??
Your question isn't specific enough. One possible explanation is that you're looking for the create() method of form datasource.
i have to add a line in my form whicg was created by using x++??
and i have no idea how can i do it?
Can you give us more information, please? What exactly have you built?
And why are you building a form from scratch in X++? It seems to be a new fashion, although I've personally done it just a few times in past twelve years (excluding dialogs). It's usually possible and much easier to start with a modeled form and merely modify it at runtime. Even the table browser form uses this strategy.
Hi,
try this code:
NumberSeq numberSeq;
SalesTable salesTable;
SalesLine salesLine;
;
ttsbegin;
numberSeq = NumberSeq::newGetNumFromCode(
SalesParameters::numRefSalesId().numberSequence,true);
salesTable.SalesId = numberSeq.num();
salesTable.initValue();
salesTable.CustAccount = '5312';//Your cust account from form
salesTable.initFromCustTable();
if (!salesTable.validateWrite())
throw Exception::Error;
salesTable.insert();
salesLine.SalesId = salesTable.SalesId;
salesLine.ItemId = ''; //your item id from form
salesLine.SalesQty = 0; //your qty from form
salesLine.createLine(true, true, true, true, true, true);
ttscommit;
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2