Posts

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() {...

Passing the value from Form to Class using X++ in AX

First create a form  Test form with a table called Test table where we will have field(Name) over there and one grid in design and one button over there.   Then create a new class and named it as TestClass public static void main(Args args) { TestTable    testTable; If(args.record().TableId == tablenum(TestTable)) { testTable = args.record(); info(strFmt("%1", testTable.Name)); } } Create a new menu item named TestMenu with action type and assign the TestClass to that.   T hen write the click method of that button as  void clicked() {     //super();     MenuFunction    mf;     args            args = new Args();     ;     args.record(TestTable);     mf = new menufunction(identifierstr(TestMenu), MenuItemType::Action);     mf.run(args); } now open the form and insert a record and click the b...

Create a new user in D365 FO using X++

X++ Code to Create a new user in D365 FO : UserInfo                              userInfo; AxaptaUserManager       Axmanage; xAxaptaUserDetails          Axdetails;        Axmanage                                       = new AxaptaUserManager(); userInfo.accountType                   = UserAccountType::ClaimsUser; userInfo.networkAlias                 = "Name@abc.com"; userInfo.networkDomain           = " https://sts.windows.net/ "; userInfo.id     ...

Create New Model and update a model in D365 FO

Image
Create New Model in D365 Model is a group of elements (metadata and source files) that typically constitute a distributable software solution. Package(dll) in D365 FO  is independent deployable unit of one or more model. A Package folder contains a descriptor folder that lists all model that belong the package. A model descriptor file contains metadata about a model properties. For creating model, Open Visual studio Navigate to “Dynamics D365 “ à Model Management à Create Model Will create a wizard for creating a model Provide Model Name, Publisher, select layer and click Next. Select create new package In the next step select reference package you want to extend and click next After model selection below summary screen will appears and click finish. Select Dynamics D365 project and give name of the project. Update model You can update model parameter after creation as below  s...

Open a URL in web browser from D365 FO using X++ code

Open a URL in web browser from D365 FO using X++ code Today, we will see how we can open a URL in web browser from D3fO using X++ code.  It is achieved using Browser class having method navigate().  It has three parameters from which only first is mandatory:    1.       string      – URL you want to browse. 2.      Boolean  – It is used to specify url should be open in same tab or new tab 3.      Boolean  – Prompt a dialog to exit the current page. Add new Runnable Class from Project in VS and include below code. class openBrowserJob {         /// <summary>     ///     Runs the class with the specified arguments.     /// </summary>     /// <param name = "_args">The specified arguments.</param>     public static void main(Args _args)     {   ...

Create and Post Inventory Movement Journal in AX / D365 FO via X++

Create and Post Inventory Movement Journal in AX / D365 FO via X++ InventJournalTable               inventJournalTable; InventJournalTrans               inventJournalTrans; InventJournalNameId           inventJournalName; InventDim                                 inventDim; JournalCheckPost                    journalCheckPost; //<Creation of journal header>         inventJournalTable.clear();   //Type Movement is Movement  Journal inventJournalName =   InventJournalName::standardJournalName(InventJournalType::...

Create and Post Inventory Adjustment Journal in AX / D365 FO via X++

InventJournalTable               inventJournalTable; InventJournalTrans               inventJournalTrans; InventJournalNameId           inventJournalName; InventDim                                 inventDim; JournalCheckPost                    journalCheckPost; //<Creation of journal header>        inventJournalTable.clear(); //Type LOSSPROFIT is Adjustment inventJournalName =   InventJournalName::standardJournalName(InventJournalType::LossProfit);         inventJournalTable.initFromInventJournalName(Inv...