Data Entity Create Virtual Field – Microsoft Dynamics 365 for Finance and Operations

Requirement is to have a custom field showing Customer Number and Name.
In that case instead of creating regular field on the Data entity and we will create a virtual field and fill the data at runtime when records are importing
Below are the steps needs to perform:
1. Create extension of the base entity (Example SalesOrderHeaderEntity) or your custom entity
2. Open the entity in designer and expand the fields
3. Right click and add new field -> StringUnmappedField
4. Set the Name property  of new field, in our case I put ‘CustomerNumberAndName’
5. Set the IsComputedField Property to No.
6. Leave the DataEntityViewMethod Empty
7.Use the virtual field to receive the information from outside(odata or excel) and parse the information
8. Use chain of command or pre-post event handler if its base entity or customise the method ‘mapEntityToDataSource’
‘example of mapEntityToDataSpurce’
public void mapEntityToDataSource(DataEntityRuntimeContext entityCtx, 
                                     DataEntityDataSourceRuntimeContext dataSourceCtx)
    next mapEntityToDataSource(entityCtx,dataSourceCtx);

    //Check if desired data source context is available
    switch (
        case dataEntityDataSourceStr(SalesOrderHeaderV2Entity, SalesTable):
            SalesTable salesTable      = _dataSourceCtx.getBuffer();
            this.CustomerNumberAndName = salesTable.InvoiceAccount + ' - ' salesTable.customerName();

10. You can get the value from odata also to use it for different purpose as per request

A financial dimension value is based on the ” record and has been used on a transaction. You cannot delete the ” record – Dynamics 365 for finance and operations – AX2012 R3


Sometime user trying to delete a record from the customer master or any data that relates to financial dimension. So, user is facing above error upon deletion.


Error occurred because data exists in the table DimensionAttributeLevelValue


  1. Access the open the table DimensionAttributeLevelValue 
  2. filter the record by Display Value field with the desired record to delete like customer number or employee number etc etc
  3. Select the filtered records
  4. Delete the selected records
  5. Then go back to customer master or where you facing the error
  6. Now try to delete you will be able to delete


AX 2012: you can directly delete the record by opening table

D365 : you can delete by access the SQL or write the runnable class to delete


Uninstall a deployable package from sandbox(UAT) environment or production- Dynamics 365 for Finance and Operations

Scenario: Sometime we need to uninstall a deployable package from the UAT or Production environment.



Below are the steps that need to be performed to uninstall a package.


  • Create a deployable package using visual studio or Build server
  • Do not extract the deployable package that is in ZIP folder (If you extract the zip folder you will face issue invalid HotfixInstallationInfo.xml file)
  • Just open the deployable package zip folder
  • Go to Deployable package zip folder -> AOS service -> Scripts folder
  • create a text file name ‘ModuleToRemove’
  • Write the module name to be removed in the the ModuleToRemove file

Screen Shot 2019-11-23 at 9.10.48 PM


  •  If you have multiple models to remove then write mode name per line as below
    • Model1
    • Model2
    • Model3
  • Note: In multiple models removing write the models name in sequence as per dependency sequence
  • Go back to main zip folder and find the file HotfixInstallationInfo.xml ,copy the file to some other location and edit the file like below




  • Edit the file should be same as above.
  • Copy and replace the HotfixInstallationInfo.xml file in the deployable folder
  • upload the file in the asset library and apply the package to the UAT environment first if applied successfully then apply to the production environment.


Please leave comments if you are facing any issue.




How to connect Power BI with Dynamics 365 for Finance and Operations

Below are the steps to connect Power BI with Microsoft Dynamics 365 for Finance and Operations


  1. Download and install the Power BI Desktop
  2. Sign in with the Licensed account
  3. In Power BI desktop ribbon click on Get Data
  4. Select OData Feed
  5. Enter the URL of the environment
  6. URL should be look like this
  7. Enter the credentials of the user account in AX/D365. Organizational account account should be better rest base upon the requirement.
  8. Once everything done , next step is downloading the tables based on the security rights and privileges of the user.
  9. Now you can select the table from the list and start working on it for your workspace.



Follow the steps to connect and do let us know if you are facing any issue.

Report Name dynamic change -attachment file Thru print management – Ax2012 – Dynamics 365 for Finance and operations

Scenario: Sometime a requirement to change the report name in the email thru print management need to change dynamically.


Class name where changes need to be done.

Report name update in the email

Class.Method: SRSReportRunPrinter.ToEmail()

check the report name in this method and update the file name as per requirement.


Report name update in the PDF and screen viewer

Class.Method: PrintMgmtReportRun.Execute()

  • check the report name
  • check the conditions for file and screen viewer
  • update the file name for file condition
  • update the file name and caption for the report


For Dynamics 365 for finance and operations use the post events of both methods




What’s new or changed in Dynamics Finance version 10.0.7 , – (January 2020)

Below are summary about the new update of Microsoft Dynamics Finance and Operations apps version 10.0.7

  1. Budget Register Entry Enhancements
  2. Ability to export records from the accounts payable invoice pool
  3. Ledger Settlements by User
  4. Forecast position reports(Public sector)
  5. Mark a Purchase agreement as closed
    • Users can now mark a Purchase agreement as “Closed” to signal the agreement is no longer actively used, making it so users will not be able to create release orders from the purchase agreement.
  6. Delayed Tax calculation on journal
  7. Reverse Journal posting
  8. Stop workflow submission when there are unallocated charges on a vendor invoice
  9. Account group selection for Chinese voucher types
  10. Sort resource in the project by invoice proposal
  11. Run Settle and post sales tax in batch mode
  12. Tax engine GTE (only available for India

For more details visit Microsoft Documentation using below link


Whats changed in 10.0.7

Entity Relationship – Common Data Service – CDS

Entity Relationships:

Entity relationships are metadata. Entity relationships define the different ways of entity records can be associated to different entity records from other entities or the same entity. Entity relationships allows the query to retrieve data efficiently.

Types of Entity relationships:

There are two types of entity relationships

One-to-many relationships:

Many related entity records associated with a single entity record (1:N) ,a parent/child relation.

Many-to-many relationships:

Many entity records are associated with many other entity records. A N to N( N:N) relation.

Entity relationship (1:N) do the following tasks, other than define the relations between the entities:

  • If record deleted on the parent entity then the record associated in the child entities also deleted.
  • When assign a record to a new owner, associated records also assign to the new owner.
  • How the record and related records will be visible to the users.


Previous Topic:

Entities – Common Data Service – CDS



Entities – Common Data Service – CDS


Data is stored in the Common Data Service database is defined as entity. Entity corresponds to a database table and each field within an entity represents a column in that table.

Common Data service, metadata(data about data), is a collection of entities. Entity metadata controls the kinds of records you can create and type of actions performed on them. When we create or edit the entities,fields relationships, we are editing this metadata.

Common data service comes with a number of  standard entities that support the core business applications.We need to become familiar with the catalog of standard entities.

For minor changes we don’t need to create new custom entities:

  • To change the field display name or label we don’t need to create custom entity.
  • We cannot delete the standard entities but we can hide them by changing the security role assignment.


Previous Topic:

What is Common Data Service?

Next Topic:

Entity Relationship – Common Data Service – CDS

What is Common Data Service? Common Data Service – CDS

Common Data Service allow you securely store and manage data that is used in the Business Applications. 

Data within common data service is stored within set of records called entities. An entity is a set of records used to store data, similar to how a table store data within the database.





Entities – Common Data Service

What is Azure Logic Apps? – Azure Logic Apps -Part 1

Azure Logic apps is a cloud service that helps

  1. Schedule
  2. Automate
  3. Orchestrate

the tasks, business process and workflows when you need to integrate apps, data, systems across the enterprise and organizations.

Logic apps simplifies how you build scalable solutions

  • App integration
  • Data Integration
  • System Integration
  • Enterprise integration

whether on cloud or on-premises or both


Example of logic apps

  1. Send Email notifications from Office 365 when event happen in various systems, apps and services.
  2. Move uploaded files from SFTP or FTP server to Azure Storage.
  3. Process or re-route orders across on-premises system or cloud service.
  4. Monitor tweets with specific text words or lines.
  5. Create records on different system based on event happens on one system.


The database could not be exclusively locked to perform the operation.(Renaming the SQL Server Database) Microsoft SQL Server

Scenario: Sometimes during renaming the Microsoft SQL Server database you might see the error, “The database could not be exclusively locked to perform the operation.Microsoft SQL Server, Error: 5030)” . 

Reason: This error occurs when the database normally in the Multi User mode.

Resolution: Run the below commands to resolve the above issue

Alter the Database to single user mode



Rename the Database


Alter the database to multi user mode



Landing page or Initial Page preference change in Dynamics 365 for Finance and operations

Scenario: Sometimes users dont want to see the dashboard or workspace whenever they login to dynamics 365 for finance and operations. They want to directly go to Employee self service(for employees) or system administration (for administrators) page.

Solution:  Below screenshots will show how you can set this option for any employee.

  1. Go to users options on the top right.
  2. Click on preference tab on the left side
  3. select the initial page for the user

Screen Shot 2019-09-12 at 12.01.18 PM.png


Screen Shot 2019-09-12 at 12.05.05 PM.png



Send email thru code with Report as attachment – Dynamics 365 Finance and Operations

Scenario: Send email thru X++ code with the report as attachment

Below is the code responsible for sending email thru code with the attachment

Guide lines to use below code

Just copy paste the code in the runnable class(job), perform below steps

Just replace the report contract name and paramters values

add send from and to email addresses,


//Set  variables

Filename fileName = “attFileName.pdf”; 

SrsReportRunController controller = new SrsReportRunController(); 

ReportContract contract = new ReportContract();

SRSPrintDestinationSettings settings;   

Array arrayFiles;   

System.Byte[] reportBytes = new System.Byte[0]();   

SRSProxy srsProxy;   

SRSReportRunService srsReportRunService = new SrsReportRunService();              

Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] parameterValueArray;   

Map reportParametersMap;

SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo();

//set the report contract parameters

contract.parm1stParameter(“firstParameter value”);

contract.parm2ndtParameter(‘2ndParamter value’);

//3rd paramter

//4th paramter

//set the report controller paramters


//set report name and desing name

controller.parmReportName(ssrsReportStr(ReportName, NewDesign));





// Provide printer settings

settings = controller.parmReportContract().parmPrintSettings();





// Below is a part of code responsible for rendering the report





reportParametersMap = srsReportRunService.createParamMapFromContract(controller.parmReportContract());       

parameterValueArray = SrsReportRunUtil::getParameterValueArray(reportParametersMap);       

srsProxy = SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig());       

// Actual rendering to byte array       

reportBytes = srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(),parameterValueArray,settings.fileFormat(),settings.deviceinfo());

// You can also convert the report Bytes into an xpp BinData object if needed       

container binData;       

Binary binaryData;       

System.IO.MemoryStream mstream = new System.IO.MemoryStream(reportBytes);       

binaryData = Binary::constructFromMemoryStream(mstream);       



            binData = binaryData.getContainer();     


System.Byte[] binData1;       

System.IO.Stream stream1;       

// Turn the Bytes into a stream       

for(int i = 0; i < conLen(binData); i++)        


            binData1 = conPeek(binData,i+1);

            stream1 = new System.IO.MemoryStream(binData1);       


//email sending settings

var mail = SysMailerFactory::getNonInteractiveMailer(); 

var messageBuilder = new SysMailerMessageBuilder();        


                .setFrom(‘’) // From email address

                .addTo(‘’) // To Email address

                .setSubject(‘Email Subject’) // Email Subject

                .setBody(‘Email Body’);        //Email Body

if (stream1 != null)       


//add attachment to the email



//send email