Posts

Showing posts from May, 2020

Create or Update Product attributes using X++ in D365 F&O

This code is to update or insert product attributes for a boolean value. Each item will have its own boolean value. We cannot update the existing boolean value for a new item. For the first time, we have to create the attribute value record id for the item and then you can update if you want to make changes to the value based on the record id.  Please change the code according to your requirement.     /// <summary>     ///  To create or update product attribute     /// </summary>     ///     public void createOrUpdateProductAttribute()     {         EcoResProduct                       product;         EcoResDistinctProductVariant        variant;         EcoResProductInstanceValue          ecoResProductInstanceValue;     ...

Create a Run base batch class in AX 7.0 / D365 F&O X++ code

Recently got a requirement to create a run base batch for enabling customer interest charges flag in credit and collection module. So, I created the below class. Please change the code according to your requirement. Step 1 - Copy and paste the below code in a new class Step 2 - Create a new action button and attach the class to it. Step 3 - Add the action button to a module.  In my case, I added it to the Credit and Collection -> Periodic area.   class BCCustTransInterestUpdate extends RunBaseBatch  {     CustAccount     custAccount;     // Dialog fields     DialogField     dlgCustAccount;     #define.CurrentVersion(1)     #define.Version1(1)     #localmacro.CurrentList         custAccount     #endmacro             protected boolean canRunInNewSession()     {         return true; ...