Are you missing model reference Error – D365 FO

We are all aware to refresh the model parameters when a new model is included in the environment. Go to Dynamics 365->  Model Management -> Update model parameters
This would work fine in development environment when we try access the object from the new model which has been added recently. What would happen if such changes for the objects are checked in ?

3

When the solution is build in other machine , it doesnot have the reference of the new model. The same error happens during TFS build as well.
So it is not feasible every time to manually refresh the model parameters in each environment.
We have a solution here. DESCRIPTOR file for the model.  This has to be updated with the new model which is referred in the solution.

 

Advertisements
Posted in D365 Operations, Dynamics 365 Operations - Ax 7.0 | Leave a comment

Apply hotfix in D365 FO environment

In this blog, I am going to brief you on importing the hotfix in D365 FO.
Log on to D365 FO and click the option to import hotfix
1
Browse to the folder where the hotfix is downloaded and map them
2
3
Click on Prepare. This button adds the objects to the environment.
4
5
Manually add the objects to the source control .
Click “Apply” button
This would bring the entire project in the “Pending Changes”.
6
7
After applying, build the model and its related models with synchronize database option.
Posted in Uncategorized | Leave a comment

Multiple DBs for D365 FO

My project had 2 companies which have different data set though their parent Organization is same. Thus, we had dedicated UAT/PPD/REF machines for each company. Though the developers check in against the same dev branch, in order to test their changes which are company specific, we initially had seperate dev boxes.
Can we have both databases in our SQL and swap it based on the dataset we need.
YES!!!
Create a new DB and name it based on the company dataset. Let`s say AxDB_1. Import the data in this db using import command. Steps given below
  1. In the command prompt , change the path to “cd C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin”.
  2. SqlPackage.exe /a:import /sf:D:\Exportedbacpac\Backup.bacpac /tsn:devBocName /tdn:TargetDBName /p:CommandTimeout=1200
  3. Usually our existing db name would be AxDB. If you need to use the imported database, rename the original Db and change the imported db to AxDb.
  4. It is not possible to directly rename the db. Commands given below
  5. USE [master];GOALTER DATABASE AxDb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;GOEXEC sp_renamedb N’AxDb’, N’AxDb2′; ALTER DATABASE AxDb2 SET MULTI_USER WITH ROLLBACK IMMEDIATE;
  6. Use the above command to rename AxDb_1 to Axdb.
      7. Reset IIS and now the new db is ready with another dataset.
      If you need to change to AxDb2, use the commands mentioned in 5 and 6.

 

Posted in Dynamics 365 Operations - Ax 7.0, Dynamics Ax | Leave a comment

Default value for a field – D365 FO

When I was trying to import data for a standard entity, I had to default value for a customized field.  Instead of over layering , I used the event handler of the method “onDefaultingRow” to set the default value for the field. It worked 🙂

DefaultValue.JPG

Posted in Uncategorized | Leave a comment

onInitialised – Post event handler D365 FO

In D365 FO, there are many event handlers for the standard methods in Ax. There are pre and post event handlers. Pre event handlers are used when our logic is to be executed before the existing one and vice versa for Post event handlers.  Event handlers are extensively used in D365 in order to avoid overlayering .
Scenario: I had a scenario where I had to call the form “SalesLine” from the standard form “Sales Quotation”. There is a reference to QuotationId in SalesLine as a part of my customization.  “Init” method in SalesLine form has a check on arguments which calls this form. So in order to include the above table “SalesTableQuotation” , I created a post event handler of the datasource

Blog_onInitiased

Click this method and copy paste it in the class .

Blog_onInitiased1

 

Blog_onInitiased2

Build and execute the form.

 

Posted in Uncategorized | Leave a comment

Display method D365 FO

This post explains on adding display method to a form.
Let us try adding a display method to a form where a new has been added to the Extension form . Since this is an extension form, a new display method cannot be added directly to this form or table.  In D365 FO, there is a slight difference in creating this . So, whenever there is an extension in D365 FO, in order to implement a process, we create a class first. So as a first step here, we are creating a class , but we use “Final” keyword .
So my class looks like this ;

final public class AESalesQuotationLineTbl_Extension

We need to mention for which object this class has been created. So decorate the class with “ExtensionOf” attribute. In this discussion, I am creating a display method for the table “SalesQuotationLine”.
[ExtensionOf(tableStr(SalesQuotationLine))]
final public class AESalesQuotationLineTbl_Extension
Third step is pretty simple, where we write the display method and the logic .

[ExtensionOf(tableStr(SalesQuotationLine))]

final public class AE_SalesQuotationLineTbl_Extension

{

public static display Qty fulfillmentRemainingQty(SalesQuotationLine _this)

{

//logic

}

Finally add the attribute to cache the display method.

[ExtensionOf(tableStr(SalesQuotationLine))]

final public class AE_SalesQuotationLineTbl_Extension

{

[SysClientCacheDataMethodAttribute(true)]

public static display Qty fulfillmentRemainingQty(SalesQuotationLine _this)

{

//logic

}

 

How do we refer this method in the form?

Please note the property “Cache data method” is set to Yes when the display method is referred.

 

 

Posted in D365 Operations, Dynamics Ax | Tagged | Leave a comment

Delete Cancelled PO – Ax2012/D365 FO

We had a scenario where we were asked to delete cancelled POs from the system. Though it seemed to be a simple task but when the POs had many confirmation versions, we ended up with the error “If previous versions exist, the current document cannot be deleted. “
In order to overcome this error, PO related records are to be deleted from the table PurchTableVersion.
Also note,deleting the corresponding Purchline would end up in a SOFT delete (records are not deleted from the database instead the field “IsDeleted” is set to yes ) . To handle this, delete the records from the table PurchLineHistory.
Deleting a cancelled PO has references in many tables, so the above post is as-is and the above suggestion can be tried in Test or other environments before doing in Prod.

 

 

Posted in Ax 2012, D365 Operations, Uncategorized | Tagged , | Leave a comment