Monday, February 22, 2021

Service Agreement creation using X++ In D365Fo

 Service Agreement creation using X++ In D365Fo


static void agreementlines(Args _args)

{

SalesTable salesTable;

SalesLine salesline ;

CustTable custTable;

numberseq numberseq;

SMAAgreementTable agreementheader;

SMAAgreementLine agreementlines;

//RetailTransactionTable retailso;

InventDim inventdim;



numberseq = numberseq::newgetnum(smaparameters::numrefagreementid());


numberseq.used();


agreementheader.agreementid = numberseq.num();


agreementheader.agreementdescription = salesLine.itemName();


agreementheader.projid = '000058';


agreementheader.agreementgroupid = 'Gold';

agreementheader.StartDate = systemDateGet();

agreementheader.EndDate= systemDateGet();


agreementheader.insert();


agreementlines.transactiontype = smatransactiontype::Item;

agreementlines.worker = hcmworker::findbyperson(dirpersonuser::find(salesline.createdby).personparty).recid;

agreementlines.projid = '000058';

agreementlines.agreementlinenum = 1;

agreementlines.Description='Project Items';

agreementlines.qty = salesline.salesqty;

agreementlines.projcurrencyid = CustTable::find(salesLine.CustAccount).Name();

agreementlines.startdate =systemDateGet();

agreementlines.enddate =systemDateGet();

agreementlines.projlinepropertyid = "prjbill";

agreementlines.ItemId='0002';

agreementlines.agreementid =agreementheader.agreementid;

agreementlines.projcategoryid = 'Car Audio';

agreementlines.initfromagreementline(agreementlines,true);

agreementlines.insert();



info(strFmt("%1",agreementheader.agreementid));

}

Keep Daxing!!

No comments:

Post a Comment