Category Archives: D365 Finance and Operations
Create new aggregate measurement / Entity store in D365 Finance and Operation to be consumed in Power BI report in D365 Finance and Operations
In D365 there are several option to export/Import data like Data Entities, BYOD, Aggregate measurements/Entity store. In this blog we will learn How to create entity store in D365 Finance and operations. Aggregate Measurements/Entity Stores are use to create Power Bi reports with nearly Live data where user have option to set its recurrence that is how often you want to refresh entity store there is no need to manually refresh the data as per suggested Batch job will run for respective entity stores. You can also forcefully refresh data by pressing refresh button on entity store page. So lets start with development of aggregate measurements, aggregate dimensions. Add New aggregate measurements object to the project where we required Add required attributes Add required measures Add required dimensions Add dimensions where view of dimension and aggregate measurements are different Build The Model Refresh Entity store from D365 Finance and Operation Environment Verify that respected view is created for aggregate measurement Add New aggregate measurements object to the project where we required. In this step we need to right click on new item Now select aggregate measurement and name it as per requirement in our case its “CFSAggregateMeasrure” Now assign required views in table property of the aggregate measurement as follow In my case I have selected “InventOnHandByWarehouse” view. Add required attributes Now add required attribute by right click on Attributes and assign required field in attributes as follows Add required measures After adding attributes add dimensions same how we added other attributes as follows After adding measure assign required field to it and operation which you want to perform on that field (for example. :- count, Average, etc. ) Add required dimensions By default some of the dimensions are provided like company and date which are showed in screen shot. And assign required fields in relation of dimensions Add dimensions where view of dimension and aggregate measurements are different If dimensions needs different view we need to create new aggregate dimension as follows In my case name of aggregate dimension is “CFSAggregateDimension ” Now assign required view to dimension as follows. After this create new attributes and assign fields to that attributes as follows After adding new dimension attribute if required you can assign more than one field reference as follows After this step assign fields to the respective field reference as follows. Now select the respected attribute and select its usage property and change it as key which will make it as dimensional key which will be helpful while making relations. There are 3 options under usage property description of each as follows Key If you specify usage property as “key” system will define the key of the dimension using this attribute Parent If you specify usage property as “parent” system will parent child hierarchy with this field as parent level. Regular If you specify usage property as “Regular” ,this is an attribute without any special behavior and it is default value. After setting usage property attach this dimension to our aggregate measurement by dropping required aggregate measurement on dimension section of it. Now define its dimension attribute property as follows After this you need to make relationship among the views as follows Fact Dimension If you want to make desired aggregate dimension as fact dimension go to desired dimension in aggregate measurement and make set “is fact dimension” property to yes/No as follows Build The Model After this case build the model which is used for this development of project as follows Refresh Entity store from D365 Finance and Operation Environment After successful build go to environment page’s Entity store section using following navigation System administration >> setup >> entity store and refresh the desired entity On required entity please press the refresh button You can also set schedule to refresh this entity by selecting edit button and enable its automatic refresh toggle and the set its recurrence as follows Verify that respected view is created for aggregate measurement In final step go to your VM’s SSMS and look for Axdw database in which in view section look for views with your aggregate measurement and dimension and name as follows After select query you can see the data of that view Now your entity store is ready to consume by power bi reporting service. Thank You!
Share Story :
Import CSV file in D365 for Finance and Operation using X++
Below is a simple example for importing data from CSV file in D365 FO using X++: /// <summary> /// import color code /// </summary> class CFSImportColorCode { /// <summary> /// main /// </summary> /// <param name = “_args”>_args</param> public static void main(Args _args) { AsciiStreamIo file; Array fileLines; FileUploadTemporaryStorageResult fileUpload; CFSEcoResColorCode colorCode; CFSImportColorCode importColorCode = new CFSImportColorCode(); Counter counter = 0; EcoResColorName color; #OCCRetryCount try { //Upload a file fileUpload = File::GetFileFromUser() as FileUploadTemporaryStorageResult; file = AsciiStreamIo::constructForRead(fileUpload.openResult()); if (file) { if (file.status()) { throw error(“@SYS52680”); } file.inFieldDelimiter(‘;’); //separator file.inRecordDelimiter(‘\r\n’); } //Read a CSV File container rec; ttsbegin; while (!file.status()) { counter++; rec = file.read(); if (conLen(rec)) { color = conPeek(rec, 2); colorCode = CFSEcoResColorCode::find(color); if(!colorCode.RecId) { colorCode.clear(); colorCode.Name = color; colorCode.Code = conPeek(rec, 1); colorCode.insert(); } } } ttscommit; info(“Operation complete.”); } catch (Exception::Deadlock) { retry; } catch (Exception::UpdateConflict) { if (appl.ttsLevel() == 0) { if (xSession::currentRetryCount() >= #RetryNum) { throw Exception::UpdateConflictNotRecovered; } else { retry; } } else { throw Exception::UpdateConflict; } } } }
Share Story :
How to delete workspace from TFS Visual Studio
Introduction: In this blog, we will see how we can delete any of the TFS workspace which is assigned to different user Even if tried to remove/delete the workspace from Visual Studio, We’re unable to map existing workspace to new user. In such scenario, It is necessary to delete the workspace explicitly while getting the error as below “The working folder ‘Workspace_Folder_Local_Path’ is already in use by the workspace : on computer Solution: 1. Open Developer Command Prompt for VS2015 from Start menu 2. For getting the list of workspaces associated with user, run below command tf workspaces /server:https://{TFS}.visualstudio.com/{CollectionName} /owner:”{Owner}” Explanation, in my case {TFS} is xxxx.visualstudio.com/defaultcollection and {Owner} as Jagdish Solanki, Eventually it will look something like this, tf workspaces /server:https://xxxx.visualstudio.com/{CollectionName} /owner:”Jagdish Solanki” Reference: 3. To delete the workspace, run below command tf workspace /server:https://{TFS}.visualstudio.com/defaultcollection /delete “{Workspace};{Owner}” It will looks something like this, tf workspace /server:https://xxxx.visualstudio.com/defaultcollection /delete “SCM-DEV-1;Jagdish Solanki” Once the above command is executed, system will prompt you if user has any pending change(s). Are you sure want to delete the workspace? (Yes/No). Enter yes Reference:
Share Story :
“Cannot delete a record in batch job(BatchJob). The corresponding AOS validation failed “while deleting batch job
while you want to delete batch job in Finance and operation you may have faced error as follows “Cannot delete a record in batch job(BatchJob). The corresponding AOS validation failed”. This blog will be helpful to resolve this issue, just follow mentioned steps. Go to batch job(system administation >> inquiries >> batch jobs) select batch jobs which you want to delete and press button change status now change its status to canceling as follows after which jobs status will change to canceling and after that it will automatically change to waiting state now try to delete it by pressing delete button. Now select yes to delete record And you have successfully deleted the record. Hope this blog was helpful to you.
Share Story :
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 !!!
Share Story :
Change planned purchase order status as draft insted of default approved
When we create purchase order using planned order its default approval status will be approved as displayed in screenshot. To change that status to draft write following code where we will change its status to draft and further code to is to remove version of purchase order which necessary to make delete button enabled on purchase order form code:- /// <summary> /// extension of class: ReqTransPoMarkFirm /// </summary> [ExtensionOf(classStr(ReqTransPoMarkFirm))] final class ReqTransPoMarkFirmCFSClass_Extension { public container conPurchOrders; /// <summary> /// updatePurchTable /// </summary> /// <param name = “_purchTable”>_purchTable</param> protected void updatePurchTable(PurchTable _purchTable) { conPurchOrders += _purchTable.PurchId; next updatePurchTable(_purchTable); } /// <summary> /// purchTablePostProcessing /// </summary> protected void purchTablePostProcessing() { next purchTablePostProcessing(); for (int i = 1; i <= conLen(conPurchOrders); i++) { PurchTable purchTable = PurchTable::find(conPeek(conPurchOrders, i), true); if(purchTable.RecId) { ttsbegin; //delete the version created for po PurchTableVersion purchTableVersion = PurchTableVersion::findLatest(purchTable.PurchId, purchTable.DataAreaId, true); if(purchTableVersion.RecId) { purchTableVersion.delete(); } purchTable.ChangeRequestRequired = NoYes::No; purchTable.DocumentState = VersioningDocumentState::Draft; purchTable.update(); ttscommit; } } } } I hope this will helo you,thank you
Share Story :
Change RFQ purchase order status as draft insted of default approved
When we create purchase order using RFQ its default approval status will be approved. To change that status to draft write following code where we will change its status to draft. create new class and add following code class CFSPOStatusRfq { [PostHandlerFor(classStr(PurchAutoCreate_RFQ), methodStr(PurchAutoCreate_RFQ, endUpdate))] public static void PurchAutoCreate_PurchReq_Post_endUpdate(XppPrePostArgs args) { //PurchTable purchTable = args.getThis(‘purchTable’); PurchAutoCreate_RFQ purchReq = args.getThis() as PurchAutoCreate_RFQ; PurchTable purchTable, purchTablenew; purchTable = purchReq.parmPurchTable(); ttsbegin; select forupdate purchTablenew where purchTableNew.PurchId == purchTable.PurchId; if(purchTablenew && purchTablenew.DocumentState == VersioningDocumentState::Approved) { purchTablenew.DocumentState = VersioningDocumentState::Draft; purchTablenew.update(); } ttscommit; } }
Share Story :
Financial Dimensions in Retail Stores and payment methods in D365 Commerce and Retail
Overview: As we are aware that Financial Dimensions are available for user to identify the posting routine of payments, sales, purchases etc in the ledger account. These values are selectable / mandatory at all checkpoints on D365 FNO. However, in retail we would have to configure the financial dimensions in Retail Store or Payment Methods of retail store. This will help user to identify the posting routine with details of the transaction. If financial dimensions are not mapped then posting will happen but it will be posted as entry without dimensions as below images. Without Financial Dimensions: With Financial Dimensions: To configure Financial Dimensions: Payment Methods: Goto Retail and Commerce > Channels > Stores In Action Tab > Set Up > Payment Methods Select Desired Payment method and in details tab you can find Financial Dimensions 2. Stores: Goto Retail and Commerce > Channels > Stores And select desired store that you want to set the default dimensions on the bottom as shown in the image. (Note: Enabling this will overwrite the Financial Dimensions that were enabled on payment methods as this will be set as Default Dimensions for all types of transactions.) Thanks! Hope this was helpful!
Share Story :
List of security roles for current user | D365FO
Introduction: In this blog, we will see how we can get a list of security roles assigned to a current user Solution: UserInfo userInfo; SecurityRole securityRole; SecurityUserRole securityUserRole; while select securityRole exists join securityUserRole where securityUserRole.SecurityRole == securityRole.RecId exists join userInfo where userInfo.id == securityUserRole.User && userInfo.id == curUserId() { info(securityRole.name); } Thanks for reading !!!
Share Story :
Duplicate address record entry through Data entity in Dynamics 365 Finance and Operations
Introduction:In this blog, we will see how to allow system for accepting duplicate addresses of customer, vendor or any other, through doing bit change in Data Entity Solution:For allowing duplicate entries we will create one field in LogisticsPostalAddress. Here field name is as IsCreateFromEntity. Field-IsCreateFromEntity will be used as flag, type of boolean / NoYesId (EDT). [ExtensionOf(tableStr(LogisticsPostalAddressBaseEntity))] final class LogisticsPostalAddressBaseEntityCFSJSTable_Extension { public static LogisticsLocationId resolveRemittanceAddressLocationId(LogisticsPostalAddressBaseEntity _postalAddressEntity, DirPartyNumber _partyNumber) { LogisticsLocationId locationId, locationIdCreateNew; locationId = next resolveRemittanceAddressLocationId(_postalAddressEntity, _partyNumber); if(_postalAddressEntity.IsCreateFromEntity) { locationId = locationIdCreateNew; } return locationId; } } Aforementioned code would replace the standard locationId variable with new locationIdCreateNew which will be null always. Once new variable locationIdCreateNew is replaced with standard code, system will generate the new locationId in the LogisticsLocation(Table) and create the same duplicate address along with state, city, country, zipcode and all other respective fields. Moreover, we will just need to pass YES value to the newly created field ISCreateFromEntity while creating the new address and run the execution. How easy it is!!! Thanks for reading !!!