22 March 2018

Update the vendor open trans to mark and update the amount in ax 2012 or AX 7 and D365


VendTransOpen vendTransOpenLoc;
VendTrans vendTransLoc;
SpecTransManager specTransManager;
boolean found;
SpecTrans specTransLoc;
CustVendOpenTransManager managerLoc = CustVendOpenTransManager::construct(ledgerJournalTrans);

select firstonly vendTransLoc
where vendTransLoc.Invoice == ledgerJournalTrans.Invoice
join firstonly vendTransOpenLoc
where vendTransOpenLoc.RefRecId == vendTransLoc.RecId;
specTransManager = SpecTransManager::construct(ledgerJournalTrans);
found = SpecTrans::existByRef(vendTransOpenLoc.DataAreaID,tableNum(VendTransOpen),vendTransOpenLoc.RecId);

if(found == false)
{
managerLoc.updateTransMarked(vendTransOpenLoc,NoYes::Yes);
ttsbegin;
specTransLoc = SpecTrans::findByRef(vendTransOpenLoc.DataAreaID,tableNum(VendTransOpen),vendTransOpenLoc.RecId,true);
specTransLoc.Balance01 = -ledgerJournalTrans.AmountCurDebit;
specTransLoc.update();
ttscommit;
}
else
{
warning(strFmt("%1 Record already marked.",ledgerJournalTrans.Invoice));
}

19 March 2018

How to get the form control access using event handler in D365 or AX7 How to enable or disable the field in the form level in D365 or AX7

How to enable or disable the field in the form level in D365 or AX7

CustTable custTable = sender.cursor(); // args.getThis() as CustTable;
FormDataSource custTable_ds = sender.formRun().dataSource(tablestr(CustTable);
FormRun element = sender.formRun();
FormControl myNewControl = element.design(0).controlName("myControl");
myNewButton.enabled(false);

=====

CustTable custTable = sender.cursor(); // args.getThis() as CustTable;
FormDataSource custTable_ds = sender.formRun().dataSource(tablestr(CustTable);
FormRun element = sender.formRun();
custTable_ds.object(fieldNum(CustTable,CustGroup)).enabled(false);

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...