Tag Archives: Class
How to export projects layerwise in Microsoft Dynamics AX 2012
Introduction: How to export projects layerwise (usr, cus, var, etc.) in Microsoft Dynamics AX 2012? Details: Here, we will see how we can export the projects from AX 2012. Now It’s very easy to do so. We need to create a class or job in the respective environment and just need to do run. static void exportProjects(Args _args) { #AotExport TreeNodeIterator tni; ProjectNode projectNode; int exportFlag; Dialog dialog = new Dialog(); DialogField folderName; DialogField projectDefinitionOnly; DialogField exportFromLayer; DialogField projectType; UtilEntryLevel layer; SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; SysExcelCell cell; SysExcelFont font; int row; CustTable custTable; str fileName; fileName = “D:\\Backup XPOs.xlsx”; //By specifying the directly, we will get the list of exported projects //Excel Part…………………………………………………………………… dialog.addText(“This will export all projects (shared or private) that exist in a selected model.”); projectType = dialog.addFieldValue(enumStr(ProjectSharedPrivate), ProjectSharedPrivate::ProjShared); projectDefinitionOnly = dialog.addField(extendedTypeStr(NoYesId), ‘Project Definition Only’); folderName = dialog.addField(extendedTypeStr(FilePath)); exportFromLayer = dialog.addField(enumStr(UtilEntryLevel), ‘Projects from layer’); dialog.run(); if (dialog.closedOk()) { if (!folderName.value()) throw error(“Missing folder”); exportFlag = #export; if (projectDefinitionOnly.value()) exportFlag += #expProjectOnly; layer = exportFromLayer.value(); switch (projectType.value()) { case ProjectSharedPrivate::ProjPrivate: tni = SysTreeNode::getPrivateProject().AOTiterator(); break; case ProjectSharedPrivate::ProjShared: tni = SysTreeNode::getSharedProject().AOTiterator(); break; } projectNode = tni.next() as ProjectNode; while (projectNode) { if (projectNode.AOTLayer() == layer && projectNode.name() like “CFS*”) //if [like] specifies, system will export the projects which names starts with CFS { projectNode.treeNodeExport(folderName.value() + ‘\\’ + projectNode.name() + ‘.xpo’, exportFlag); row++; } projectNode = tni.next() as ProjectNode; } info(“Projects Exported Successfully & Exported Projects List to Excel Sheet”); } else warning(“No action taken…”); } After running the class it will prompt as below. After that select the directory where to export all projects and select the layer from which layer all projects should be exported. Thanks for reading!!!
Enable/Disable & Visibility an Action pane button on a list page using interaction class in D365
Introduction: In this blog, we will see how we can enable/disable or change the visibility of the form control in interaction class. Standard behavior of the form, system does not allow us to write code on form which comes under form template -> List page It Seems like below attached image (Here we will consider form VendTableListPage. Property of form as shown below) Each ListPage form consisting with an interaction class as shown in property, Here it is VendTableListInteraction. Each interaction class has one override method which is selectionchanged() Solution: Here we will override the method of selectionchanged() as below [ExtensionOf(classStr(VendTableListPageInteraction))] final class VendTableListPageInteractionCFSJSClass_Extension public void selectionChanged() { next selectionChanged(); //for visibility this.listPage().actionPaneControlVisible(formControlStr(VendTableListPage, ), false); //for enable/disable this.listPage().actionPaneControlEnabled(formControlStr(VendTableListPage, true); } For all other ListPage, we can go through interaction class. For reference, go through below mentioned classes: AgreementListPageInteraction BankDocumentTableListPageInteraction CatProcureOrderListPageInteraction CatVendorCatalogListPageInteraction CustBillOfExchEndorseListPageInteraction CustomsExportOrderListPageInteraction CustPDCListPageInteraction CustPDCSettleListPageInteraction CzCustAdvanceInvoiceListPageInteraction CzVendAdvanceInvoiceListPageInteraction EcoResCategoryHierarchyPageInteraction EcoResProductListPageInteraction EmplAdvTableListPageInteraction EntAssetObjectCalendarListPageInteraction EntAssetWorkOrderPurchaseListPageInteraction EntAssetWorkOrderPurchReqListPageInteraction EntAssetWorkOrderScheduleListPageInteraction EPRetailPickingListPageInteraction EPRetailStockCountListPageInteraction EximAuthorizationListPageInteraction EximDEPBListPageInteraction EximEPCGListPageInteraction GlobalAddBookListPageInteraction HcmCourseAttendeeListPageInteraction HcmWorkerAdvHoldTableListPageInteraction InventBatchJournalListPageInteraction InventDimListPageInteractionAdapter JmgProdStatusListPageInteraction JmgProjStatusListPageInteraction PCProductModelListPageInteraction PMFSeqReqRouteChangesListPageInteraction ProdBOMVendorListPageInteraction ProdRouteJobListPageInteraction ProdTableListPageInteraction ProjForecastListPageInteraction ProjInvoiceListPageInteraction ProjInvoiceProposalListPageInteraction ProjProjectContractsListPageInteraction ProjProjectsListPageInteraction projProjectTransListPageInteraction ProjUnpostedTransListPageInteraction PurchCORListPageInteraction PurchCORRejectsListPageInteraction PurchLineBackOrderListPageInteraction PurchReqTableListPageInteraction PurchRFQCaseTableListPageInteraction PurchRFQReplyTableListPageInteraction PurchRFQVendorListPageInteraction_PSN PurchRFQvendTableListPageInteraction PurchTableVersionListPageInteraction ReqTransActionListPageInteraction ReqTransFuturesListPageInteraction ReqTransListPageInteraction RetailOnlineChannelListPageInteraction RetailSPOnlineStoreListPageInteraction ReturnTableListPageInteraction SalesAgreementListPageInteraction SalesQuotationListPageInteraction SalesTableListPageInteraction SysListPageInteractionBase SysUserRequestListPageInteraction UserRequestExternalListPageInteraction UserRequestListPageInteraction VendEditInvoiceHeaderStagingListPageInteraction VendNotificationListPageInteraction VendPackingSlipJourListPageInteraction VendPDCListPageInteraction VendPDCSettleListPageInteraction VendProfileContactListPageInteraction VendPurchOrderJournalListPageInteraction VendRequestCategoryListPageInteraction VendRequestListPageInteraction VendRequestWorkerListPageInteraction VendTableListPageInteraction VendUnrealizedRevListPageInteraction Thanks for reading !!!