Working With Extension/Model (Part 2) – D365FO
November 4, 2019
Man working with laptop
Working With Extension/Model (Part 4) – D365FO
November 4, 2019

Working With Extension/Model (Part 3) – D365FO

Working With Extension/Model (Part 3) – D365FO

Use objects of other models in our custom model and solve reference error

In this part we will solve the common issue usually faced at the beginner stage while working with models and extension in D365. 

Let's say we need to search for the attachment in a sales order. We will find it through job using x++ query.

Create a job (Runnable class)

We need to use DocuRef table in our query to search for the attachments of the sales order. 

Now, when we build the project it will show the error shown below in the image.

Following error "does not denote a class. . . " usually occurs when the model of the project does not refer to the model of the objects using in it. 
DocuRef table belongs to the other model i.e. Application Foundation. Which is not included in our custom model AXGuru_Customizations.

We need to update our model which we have previously discussed the steps in Part 2. For an ease, I am showing steps here too.

Go to tab Dynamics365 > Model Management > update model parameters...
select the model AXGuru_Customizations then click Next.

Check the ApplicationFoundation Model. Then click Next and click Finish on the next screen.

Our model is updated now with the reference of ApplicationFoundation model. Which means that we can now use objects related to this model in our custom model. 

Build the solution. 

Build completed successfully. 

For any further information
Saeed ur Rehman
Saeed ur Rehman
Dynamics AX/365 developer