Dynamics 365 FO - Create simple runbase
Nghia Song - Microsoft Dynamics 365 Technical Consultant
Nghia Song
Tel - WhatsApp: +84967324794
Email: songnghia.uit@gmail.com
Create simple runbase
Step | Screenshots | Description |
0 | Start Visual Studio using Run as administrator. | |
1 | Create new label id | |
public class NVWSumCustomerTransaction extends RunBase { DialogField dialogAccount; DialogField dialogFromDate; DialogField dialogToDate; CustAccount custAccount; FromDate fromDate; ToDate toDate; #DEFINE.CurrentVersion(1) #LOCALMACRO.CurrentList custAccount, fromDate, toDate #ENDMACRO public Object dialog() { DialogRunBase dialog; DialogGroup groupPeriod; dialog = super(); dialogAccount = dialog.addFieldValue(extendedTypeStr(CustAccount), custAccount); groupPeriod = dialog.addGroup("Period"); dialogFromDate = dialog.addFieldValue(extendedTypeStr(FromDate), fromDate, "Period from"); dialogToDate = dialog.addFieldValue(extendedTypeStr(ToDate), toDate, "Period to"); return dialog; } public boolean getFromDialog() { boolean ret; ret = super(); custAccount = dialogAccount.value(); fromDate = dialogFromDate.value(); toDate = dialogToDate.value(); return ret; } public container pack() { return [#CurrentVersion,#CurrentList]; //return [1,list<'C0001','01/01/2015', '02/01/2015'>]; } public boolean unpack(container _packedClass) { Version version = RunBase::getVersion(_packedClass); switch (version) { case(#CurrentVersion) : [version,#CurrentList] = _packedClass; break; default : return false; } return true; } static client server ClassDescription description() { return "@NVW:NVWSumCustomerTransaction"; } public void run() { CustTrans custTrans; select sum(AmountMST) from custTrans where custTrans.AccountNum == custAccount && custTrans.TransDate >= fromDate && custTrans.TransDate <= toDate; info(strFmt("Sum equals %1", custTrans.AmountMST));
} static void main(Args _args) { NVWSumCustomerTransaction demoRunBase; demoRunBase = new NVWSumCustomerTransaction(); if (demoRunBase.prompt()) { demoRunBase.run(); } } } | Create class and extend runbase | |
Create action menu | ||
Add menu item to menus | ||
Link to this report | ||
The UI of this | ||
No comments:
Post a Comment