How to Import Records from Excel Using X++ Code in D365FO

  How to Import Records from Excel Using X++ Code in D365FO   Include the below namespace in X++ code it will requires to import Excel. Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange;   In addition to the basic reference, include (Directory and DirectoryUpgrade Packages) X++ Code: Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange; class ReadExcel {   public static void main(Args _args)    {     Int id;     Str Name;      System.IO.Stream stream;       ExcelSpreadsheetName sheet;              FileUploadBuild fileUpload,fileUploadBuild;       DialogGroup dialogUploadGroup;       FormBuildControl formBuildControl;   ...

Passing Args from one Form to another Form in dynamics AX


Args in dynamics AX is one can easy way to pass arguments from one Form to another Form.
Here, how to pass Arguments from Form to Form. 
So when I select one record in grid Form A, that record will be passed to Form B
Form B will filter the record and will show.
Step 1: Make one TestTable which has three fields named (ID, name).
Step 2: Make FormA with datasource as TestTable and drag the datasource fields into the design Grid.
Step 3: Drag one button and override the click method and write the following code.
void clicked()
{
Args args;
FormRun formRun;
;
super();
args = new args(formstr(FormB)); // sending record to FormB using Args
args.record(TestTable);
formrun = classfactory.formrunclass(args);
formrun.init();
formrun.run();
formrun.wait();
formrun.detach();
}

step 4: Make FormB with datasource as same table for which you take for Form A i.e., TestTable
step 5: write the following code in to the init method of FormB.

public void init()
{
TestTable  testTable;
super();
testTable = element.args().record();
SampleTable_ds.query().dataSourceTable(Tablenum(TestTable)).addRange(fieldNum(testTable,RecId)).
value(SysQuery::value(testTable.Recid));
}
It will filter the records in Form B

Comments

Popular posts from this blog

D365 FO: REFRESH CALLER FORM DATA SOURCE FROM A CLASS X++

CREATE AND POSTING PURCHASE ORDER THROUGH X++ DYNAMICS AX