AX Archives -

Tag Archives: AX

Sales return order line registration in D365FO and AX 2012

Introduction: Sales return order line registration in X++ Details:  Consider SalesReturnOrderRegisterLine is the table where records are with SalesLine referenced. If we are required to register serialized items than salesReturnOrderRegisterLine.inventSerialId will be considered and if item referred with batch then salesReturnOrderRegisterLine.inventBatchId will be considered. public static void inventoryRegistration(SalesId _salesId) { SalesReturnOrderRegisterLine salesReturnOrderRegisterLine; SalesLine salesLine; TmpInventTransWMS tmpInventTransWMS; InventTransWMS_Register inventTransWMS_Register; InventDim inventDim; InventTrans inventTrans; VendPackingSlipTrans vendPackingSlipTransLoc; InventTransOrigin inventTransOrigin; while select salesReturnOrderRegisterLine where salesReturnOrderRegisterLine.SalesId == _salesId { salesLine = SalesReturnOrderRegister::updateDispositionCode(salesReturnOrderRegisterLine.InventTransId); inventTransWMS_Register = InventTransWMS_Register::newStandard(tmpInventTransWMS); select firstonly inventTrans where inventTrans.StatusReceipt == StatusReceipt::Ordered exists join inventTransOrigin where inventTransOrigin.RecId == inventTrans.InventTransOrigin && inventTransOrigin.InventTransId == salesLine.InventTransId && inventTransOrigin.ReferenceId == _salesId; tmpInventTransWMS.clear(); tmpInventTransWMS.initFromInventTrans(inventTrans); tmpInventTransWMS.InventQty = salesReturnOrderRegisterLine.SalesQty; tmpInventTransWMS.LineNum = int642int(salesLine.LineNum); inventDim = salesLine.inventDim(); inventDim.inventSerialId = salesReturnOrderRegisterLine.inventSerialId; inventDim.inventBatchId = salesReturnOrderRegisterLine.inventBatchId; tmpInventTransWMS.InventDimId = InventDim::findOrCreate(inventDim).inventDimId; tmpInventTransWMS.ItemId = salesLine.ItemId; inventTransWMS_Register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, InventDim::find(tmpInventTransWMS.InventDimId)); if (!inventTransWMS_Register.updateInvent(salesLine)) { throw error(“Error during sales return order registration”); } } } Consider SalesReturnOrderRegister is the class which has below static methods public static SalesLine updateDispositionCode(InventTransId _inventTransId) { SalesLine salesLine = SalesLine::findInventTransId(_inventTransId, true); ReturnDispositionCode returnDispositionCode; SalesReturnOrderRegister::runPreReturnOrderRegisterLine(salesLine); salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; salesLine.update(); return salesLine; } public static void runPreReturnOrderRegisterLine(SalesLine _salesLine) { InventTransOriginId salesLineInventTransOriginId; InventTransOriginId reservationLineInventTransOriginId; SalesLine reservationLine; ReturnDispositionCode returnDispositionCode; if (_salesLine.ReturnStatus == ReturnStatusLine::Awaiting) { if (!_salesLine.ReturnAllowReservation && _salesLine.isStocked()) { SalesLine::changeReturnOrderType(_salesLine.InventTransId); _salesLine = SalesLine::findInventTransId(_salesLine.InventTransId, true); } select firstOnly returnDispositionCode where returnDispositionCode.DispositionAction == DispositionAction::Credit; _salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; _salesLine.update(); } else if (_salesLine.ReturnStatus == ReturnStatusLine::Registered) { select forupdate firstonly reservationLine where reservationLine.InventRefTransId == _salesLine.InventTransId; if (reservationLine || _salesLine.qtyMarked()) { if ((_salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReplaceScrap || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReturnToCust || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::Scrap)) { if (reservationLine.SalesQty == reservationLine.RemainSalesPhysical) { reservationLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(reservationLine.DataAreaId, reservationLine.InventTransId); salesLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(_salesLine.DataAreaId, _salesLine.InventTransId); InventTransOrigin::deleteMarking(salesLineInventTransOriginId, reservationLineInventTransOriginId, -_salesLine.QtyOrdered); reservationLine.delete(); } } else { throw error(“@SYS332911”); } } } } Thanks for reading and stay connected with us for more updates!!! Jagdish Solanki | Senior Technical Consultant | CloudFronts Business Empowering Solutions Team “Solving Complex Business Challenges with Microsoft Dynamics 365 & Power Platform”

How to Add Workflow form for D365 finance and Operation modules

In D365 Finance and Operation for some modules, there is no Workflow setup. eg:- Inventory management module. In such a case, we need to perform the following steps after which you can see the workflow setup form which will include all the workflows for that specific module. First, we need to add the Display menu item and set properties as: Enum Type parameter to ModuleAxapta and Enum Parameter to the module ( in our case Inventory ) Object Type to form. Object to WorkflowtableListPageRnr   After this create a menu extension of the module where we need to place the form. Drag the display menu item to the menu extension.   After a successful build,  we are set to enlist new workflows for an inventory module using workflow forms. The same way you can attach workflow form to the new module as follows:- Create an extension of ModuleAxapta Base Enum Add a new element to base enum and name it your custom module name and label it Create a new Display Menu Item and set its properties as follows Create a new menu and set its label and name as per your requirement And insert your display menu item to your custom menu/module Create an extension of “MainMenu” Menu and add new menu item reference and set its properties as follows Build the solution your Workflow setup form will be visible for that module

Error “A reference to ‘xyz ‘ is required to compile this module” solution

Many of the time while building project/solution we came across the “reference is required to compile this module error”. The reason behind this error is that your module’s reference package is missing the required package. In error itself, the missing module can be rectified as shown for example in following screenshot reference to “SourceDocumentationTypes” is not made. Now you have to add a missing reference to your module as follows: Select Update model Parameters from Dynamics 365 >>Model Management>>Update model Parameter Now select the required model name from the model list and click on Next. Now make sure to select the checkbox in front of a required reference from reference packages (In our case SourceDocumentationTypes reference was not there ) and click on next. Now click on finish. Now after attaching a reference to the package build package/Solution and you have solved your error.

Change Tracking for Data Entities in D365 Operations

Introduction: In this blog article, we will see how we can track changes in data made since last export using Data Entities in D365 Operations. It is basically an SQL Change Tracking feature. Steps: Go to Data Management -> Data Entities. Select the Entity for which you want to enable Change Tracking. In the Action Pane, go to Change Tracking. There are 3 options: Enable primary table – It will only track changes made on root table. Enable entire entity – It will enable tracking for all Writable Datasource used in the entities. Enable custom Query – You can create a custom query to track changes on the required tables. You can also disable the change Tracking by clicking on ‘Disable Change Tracking’ option. You should be careful while enabling change tracking as it will require additional processing for maintaining data for changed records.

Fetch Hierarchical data for Product Category in Dynamics 365 Operations

For today’s modern day business that needs customer satisfaction, scalability and digital intelligence, dynamics 365 finance and operations is a complete ERP solution and is one of the most trusted software in the world without any doubt. This ERP solution helps you to innovate your products and processes so that client’s expectations can be met on time and your business can survive well in the cut-throat competition. It also gives visibility to your business across customer sales and service, marketing system and connected distribution. It simplifies production floor management, speeds up product introduction and offers flexibility in delivery alternatives. When it comes to the impact on your finance, you can gain immediate financial insights, drive corporate strategy and growth and through efficient collection management, decrease debts considerably. Introduction: In this blog article, we will see how we can fetch hierarchical data using X++. How to fetch? We will take a scenario where we will pass a category hierarchy and will fetch all categories of that hierarchy and its child category. public class ProductCategoryHierarchy {     EcoResCategory    category;      public void ParentCategory()     {                while select category where category.CategoryHierarchy == “Brands”         {             //code             this.getChildrenCategory(category.RecId);         }       }     /// <summary>     /// get categories of child product     /// </summary>     public void getChildrenCategory(EcoResCategoryId ParentCategory)     {         while select category where category.ParentCategory == ParentCategory         {             //code   this.getChildrenCategory(category.RecId);         }       }  }

SEARCH :

FOLLOW CLOUDFRONTS BLOG :

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :