Tuesday, March 22, 2016

OCT 19 Microsoft Dynamics AX 2012 DIXF – Composite Entity Primer (XML format)


http://ax2012dmfdataimport.blogspot.in/2014/10/microsoft-dynamics-ax-2012-dixf.html

Microsoft Dynamics AX 2012 DIXF – Composite Entity Primer (XML format) – Part1
 
Purpose: The purpose of this document is to illustrate how to use Dynamics AX 2012 DIXF for import of custom data. In this particular primer I'll be focusing on Entity type = Composite Entity using XML file format.
 
Challenge: Data model changes in Dynamics AX related to high normalization and introduction of surrogate keys made import of data more complex. Data Import Export Framework for Microsoft Dynamics AX 2012 was designed and developed to address this challenge. Data Import Export Framework for Microsoft Dynamics AX 2012 provides architectural foundation for data import process as well as it ships with the numerous standard templates covering most important types of business data.
 
Solution: Dynamics AX 2012 ships with the number of DIXF templates which can be used in data import scenarios. For import of custom data Data Import Export Framework "Create a custom entity for data import/export" wizard which assists you in creating of required DIXF objects infrastructure. A composite entity groups multiple related entities together. In my example composite entity will combine header (AlexTable) and lines (AlexLine) entities together.
 
Data Model:
 
 Table Name
Table Description
AlexTable
Sample header table
AlexLine
Sample lines table
 
Data Model Diagram:
 
Sample Data Model
 
<![if !vml]><![endif]>
 
Process Overview:
 
 
Walkthrough:
 
Project1
 

Please note that I initially created 2 tables to implement a data model for this scenario

AlexTable table


AlexLine table


Processing group: Alex


Custom entity wizard: AlexTable

Welcome


Select a table: AlexTable


Select code generation parameters


Please note that for the sake of simplicity I created a fake display menu item AlexTable

Display Menu Item: AlexTable


It is also important to mention that while creating DIXF infrastructure for AlexTable I specified/marked "Is composite entity" checkbox [V]

Fields in the target table


Wizard complete


During creation of DIXF infrastructure for AlexTable table I was asked to confirm adding relation. This is required to automatically create table relationships between your newly created Staging table and necessary DIXF framework tables

Confirm adding relation


After Custom entity wizard is completed DMFAlexTableEntity project will be created automatically

Project: DMFAlexTableEntity


Please note that DMFAlexTableEntityClass class, DMFAlexTableEntity table and DMFAlexTableTargetEntity query have been generated by Create entity wizard automatically

Class: DMFAlexTableEntityClass


Query: DMFAlexTableTargetEntity


Table: DMFAlexTableEntity


Please note that because we marked "Is Composite entity" checkbox the system added RowId field to Staging table automatically. RowId field is used to link related tables records (header and lines in my scenario) as well as by DIXF errors handling mechanism (error table)

The following standard templates entities in the Data Import Export Framework include a RowID field that can be used in composite entities: DMFSalesTableEntity, DMFSalesLineEntity, DMFPurchTableEntity, DMFPurchLineEntity, DMFBOMEntity and DMFBOMVersionEntity.
For the sake of simplicity in this walkthrough I'm not going to introduce a function to link header record and lines records based on RowId field, and will import the data unlinked as is. However please see example below of how such function is implemented in a standard DMFSalesLineEntity template

/Classes/DMFSalesLineEntityClass/Methods/generateSalesTableLink
 
[DMFTargetTransformationAttribute(true),DMFTargetTransformationDescAttribute("@DMF580"),
DMFTargetTransformationSequenceAttribute(1)
,DMFTargetTransFieldListAttribute([fieldStr(DMFSalesLineEntity,SalesId)])
]
public container generateSalesTableLink(boolean _stagingToTarget = true)
{
    container        res;
    SalesTable       salesTable;
    SalesTableForm   salesTableForm;
 
    if (_stagingToTarget)
    {
        if(this.isCompositeEntity() && entity.RowId)
        {
            res = [(select firstOnly1 dmfSalesTableEntity
                where dmfSalesTableEntity.RowId == entity.RowId
                   && dmfSalesTableEntity.DefinitionGroup == entity.DefinitionGroup
                   && dmfSalesTableEntity.ExecutionId == entity.ExecutionId).SalesId];
        }
        else
        {
            …
        }
    }
    else
    {
        res = [target.SalesId];
    }
    return res;
}
 
Once you introduce this function you will also need to modify Source to Staging mapping to bring over RowId values from external source and then also Staging to Target mapping to add transformation (RowId -> RecId) based on this function

Please note that in my previous post I explained how you can implement such function using custom ID field which effectively plays the same role as RowId: http://ax2012dmfdataimport.blogspot.com/2013/03/microsoft-dynamics-ax-2012-dmf.html

Custom entity wizard: AlexLine

Welcome


Select a table: AlexLine


Select code generation parameters


Please note that in order to automatically add RowId field to a newly generated Staging table I
marked "Is Composite entity" checkbox

Fields in the target table


Wizard complete


I was asked to confirm adding relation again for DMFAlexLineEntity Staging table

Confirm adding relation


After Custom entity wizard is completed DMFAlexLineEntity project will be created automatically

Project: DMFAlexLineEntity


Please note that DMFAlexLineEntityClass class, DMFAlexLineEntity table and DMFAlexLineTargetEntity query have been generated by Custom entity wizard automatically

Class: DMFAlexLineEntityClass


Query: DMFAlexLineTargetEntity


Table: DMFAlexLineEntity


Target entities: Alex


Child entities: Alex


Now let's take a moment to speak about Source data formats

Data Import Export Framework does support XML format. And not only this, DIXF also allows you to use different types of XML structure: Element-based and Attribute-based

I'll start with Element-based XML structure. For this purpose I created XML1 Source data format shown below

Formats: XML1 Element-based XML structure


Once format is created now our goal will be to create appropriate XML Files for Consolidated data import. But before I do that I'll go ahead and generate Source files for each entity included into Consolidated entity
 
AlexTable: Generate source file


Generate source file wizard

Welcome


Display data


Please note that I selected XML type = XSD to generate XSD schema for AlexTable

Infolog


Here's how XSD schema looks like

AlexTable XSD schema


AlexTable XSD schema (text)
 
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Document">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="AlexTableEntity">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="FieldA" nillable="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="FieldB" nillable="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="ID" nillable="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
     </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
After that I also Generated sample file with XML type = XML

Generate sample file: XML type = XML


Here's the file for AlexTable

AlexTableEntity file


AlexTableEntity file (text)
 
<?xml version="1.0" encoding="utf-8"?><Document><AlexTableEntity><FieldA>String</FieldA><FieldB>String</FieldB><ID>String</ID></AlexTableEntity></Document>
 
Now I'll repeat this procedure for AlexLine table

Generate source file: AlexLine


Generate source file wizard

Welcome


Display data


Please note that I first selected XML type = XSD to generate XSD schema for AlexLine

Infolog


Here's how XSD schema for AlexLine looks like

AlexLine XSD schema


AlexLine XSD schema (text)
 
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Document">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="AlexLineEntity">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="FieldC" nillable="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="FieldD" nillable="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="ID" nillable="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
Finally I'll also generate sample file for AlexLine

Generate sample file: AlexLine


AlexLineEntity file


AlexLineEntity file (text)
 
<?xml version="1.0" encoding="utf-8"?><Document><AlexLineEntity><FieldC>String</FieldC><FieldD>String</FieldD><ID>String</ID></AlexLineEntity></Document>
 
Okay so now we know who the data in Element-based XML format should look like for AlexTable and AlexLine records

My next step would be to explore Attribute-based XML format. For this purpose I added another Source data format XML2 with XML structure = Attribute

Formats


Similarly to what I did for Element-based XML format I'll generate sample XML files for Attribute-based XML format scenario, so then we'll be able to compare 2 scenarios

Generate source file: AlexTable


Generate source file wizard

Welcome


Display data  (XML type = XSD)


Infolog


AlexTable XSD schema


AlexTable XSD schema (file)
 
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Document">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="AlexTableEntity">
          <xs:complexType>
            <xs:attribute name="FieldA">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="10" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="FieldB">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="10" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="ID">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="10" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
Display data (XML type = XML)


AlexTableEntity file


AlexTableEntity file (text)
 
<?xml version="1.0" encoding="utf-8"?><AlexTableEntity><AlexTableEntity FieldA="String" FieldB="String" ID="String" /></AlexTableEntity>
 
Generate source file: AlexLine


Generate source file wizard

Welcome


Display data (XML type = XSD)


Infolog


AlexLine XSD schema


AlexLine XSD schema (text)
 
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Document">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="AlexLineEntity">
          <xs:complexType>
            <xs:attribute name="FieldC">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="10" />
                </xs:restriction>
              </xs:simpleType>
           </xs:attribute>
            <xs:attribute name="FieldD">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="10" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="ID">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="10" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
Display data (XML type = XML)


AlexLineEntity file


AlexLineEntity file (text)
 
<?xml version="1.0" encoding="utf-8"?><AlexLineEntity><AlexLineEntity FieldC="String" FieldD="String" ID="String" /></AlexLineEntity>
 
As you can see we got 2 different sets of sample files for AlexTable and AlexLine when using 2 different XML formats (Element-based and Attribute-based)

Also please note that Generate sample file function is not available for Composite entity, but you can execute it individually for each entity included into Composite entity. The logical reason would be that when having multiple entities included into a Composite entity you don't know the nature of the relationships between those tables upfront. That's why when having individual sample files for each entity you can combine them into a single Consolidated file for data import

All right! Now we familiarized ourselves with data format and we can switch to the creation of Consolidated files

Next step for me is to specify entities for processing group. Please note that once I specify Alex Composite entity in the first row the rest of 2 records will be added automatically because the system knows that Alex Composite entity consists of AlexTable and AlexLine

Select entities for processing: Alex 


I'll start with Element-based XML format scenario that's why I selected Source data format = XML1

This is how my Consolidated file for Element-based XML format looks like

AlexXMLElement file


AlexXMLElement file (text)
 
<?xml version="1.0" encoding="utf-8"?>
<Document><AlexTableEntity><AlexTableEntity_Id>1</AlexTableEntity_Id><FieldA>A1</FieldA><FieldB>B1</FieldB><ID>1</ID><RowId>1</RowId></AlexTableEntity><AlexLineEntity><AlexTableEntity_Id>1</AlexTableEntity_Id><FieldC>C1</FieldC><FieldD>D1</FieldD><ID>1</ID><RowId>1</RowId>
</AlexLineEntity></Document>
 
Please note that I specified RowId values for both header and line in order to be able to link them appropriately. Also I introduced "AlexTableEntity_Id" element to define a metadata relationship between AlexTable (header) and AlexLine (line). The idea is to introduce an element which names consists of the name of the parent/header entity (AlexTableEntity) and "_Id" and add this element to both header data and line data

The next step will be to specify this file for Composite entity in the list of Processing group entities and generate source mapping based on this file   

Generate Source Mapping


We've successfully generated mappings for AlexTable and AlexLine entities

Let's review these mappings

AlexTable Mapping (Visualization)


AlexTable Mapping (Details)


I'll also map RowId field to bring over the information about how header links to line(s)

AlexTable Mapping (Visualization)


AlexTable Mapping (Details)


AlexLine Mapping (Visualization)


AlexLine Mapping (Details)


Similar to above I'll also RowId field for the line

AlexLine Mapping (Visualization)


AlexLine Mapping (Details)


Now we can test what we've got by using Preview function

Preview AlexTable


Preview AlexLine


We can successfully see the data retrieved for AlexTable and AlexLine entities, so now we can execute the actual data import process

Copy data to Staging


Create a job ID for the staging data job


Staging data execution


Staging:-AlexXMLElement


Infolog


Great! We've successfully brought the data from source XML file over to Staging tables

DMFAlexTableEntity Table browser


DMFAlexLineEntity Table browser


The last step in this scenario will be to copy data to target

Processing group: Copy data to target


Select a job ID to run


Target data execution


Target:-AlexXMLElement


Infolog


Success! We should be able to see the data in target tables now

AlexTable Table browser


AlexLine Table browser


This concludes the first scenario with Element-based XML file

Now we can switch to Attribute-based XML file 

Select entities for processing: Alex 


This time my Consolidated file will look different

AlexXMLAttribute file


AlexXMLAttribute file (text)
 
<?xml version="1.0" encoding="utf-8"?>
<AlexTableEntity>
    <AlexTableEntity AlexTableEntity_Id="1" FieldA="A2" FieldB="B2" ID="1" RowId="1" />
    <AlexLineEntity AlexTableEntity_Id="1" FieldC="C2" FieldD="D2" ID="1" RowID="1" />  
</AlexTableEntity>
 
Please note that I still included the same information there, but in a different format. Thus I still have all data fields specified, RowID field and "AlexTableEntity_Id"

Generate Source Mapping


After we successfully generated Source mapping we can review them

AlexTable Mapping (Visualization)


AlexTable Mapping (Details)


Similar to all above I'll also map RowId field

AlexTable Mapping (Visualization)


AlexTable Mapping (Details)


AlexLine Mapping (Visualization)


AlexLine Mapping (Details)


Of course, I'll not forget about RowId field

AlexLine Mapping (Visualization)


AlexLine Mapping (Details)


Now we can test what we've got!

Preview AlexTable


Preview AlexLine


Everything shows up there fine! So we can proceed with Copy data to Staging

Copy data to Staging


Create a job ID for the staging data job


Staging data execution


Staging:-AlexXMLAttribute


Infolog


At this point we've successfully imported the data into Staging tables

DMFAlexTableEntity Table browser


DMFAlexLineEntity Table browser


Now we can copy data to target

Processing group: Copy data to target


Select a job ID to run


Target data execution


Target:-AlexXMLAttribute


Infolog


Now we can check the data in target tables

AlexTable Table browser


AlexLine Table browser


Success!

This concludes Attribute-based XML format scenario and this walkthrough!

Versions: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 Data Import Export Framework

Summary: In this document I explained how to use Data Import Export Framework in Microsoft Dynamics AX 2012 in order to import custom data (header and lines). This approach is especially recommended for large scale data migrations and allows for much better performance comparing to usage of Microsoft Dynamics AX 2012 Excel Add-in. Data Import Export Framework in Microsoft Dynamics AX 2012 already ships with numerous standard templates for most important types of business data. Please note that DIXF ships with more than 150 ready-to-go templates. 

Author: Alex Anikiiev, PhD, MCP

Tags: Dynamics ERP, Dynamics AX 2012, DIXF, Data Import Export Framework, Data Import, Data Conversion, Data Migration, Composite Entity, XML, Attribute, Element
 
Note: This document is intended for information purposes only, presented as it is with no warranties from the author. This document may be updated with more content to better outline the concepts and describe the examples.


Install the Data import/export framework (DIXF) (AX 2012)

Missing Default Order Settings with DIXF Products import


How would you like to double the number of DIXF entities you have?

A colleague pointed me to a hotfix that will be released in AX 2012 R3 CU10. The hotfix is KB3061216 and is called ‘Support for new DIXF entities’. The hotfix description lists fourteen AX modules and shows the number of new entities in each module; in total 226 new entities. But it doesn’t tell you what the new entities are. I only knew one way to find out, so I installed it into my R3 CU9 Demo VM.
Since I wanted to know which entities were new, first, I dumped a list of the entities that I had in CU9 into Excel; 238 in total. And then I installed KB3061216. And after completing the software update checklist, I rushed to the ‘Target entities’ form and hit the Export to Excel shortcut. And I still had 238 entities. Hmm. Not what I was expecting. Perhaps the list needs refreshing. I looked around for an option to do that, but couldn’t find one. What if I delete them all, and then re-open the Target entities form? Worth a try – and that did it. Now I have 467 entities.
That’s a whole 229 new entities. Actually, I did some comparisons and found that two of the entities in CU9 had disappeared – ‘VendPaymFee’ (Payment fee in the A/P module) and ‘Terminals’ from the Retail module. So that’s 231 new entities. What are they all? To save you the bother of installing the hotfix to find out, I’ve attached an Excel list of all 467 entities.
In the list, the lines in green are entities that were added by the hotfix. I don’t know if any existing entities have been extended – I took a look at the Product entity and it appeared that it had not been. Let me know in the comments below if any entities you’ve really been waiting for have been added.

Missing Default Order Settings with DIXF Products import

I was importing new Released Products into Microsoft Dynamics AX 2012 R3 using Data Import Export Framework’s ‘Products’ entity. Although the import was apparently successful, I found that fields on the Default Order Settings form were all greyed out.
Default Order Settings
All fields on the Default Order Settings form are greyed out.
I had last encountered this problem nearly two years ago in AX 2012 FP. At that time, DIXF was in Beta, and Microsoft were not accepting bug reports. Thinking about filing one now, I decided to investigate the cause. The Default Order Settings form has three datasources:
  • InventItemInventSetup
  • InventItemPurchSetup
  • InventItemSalesSetup
Looking at these tables, I could see that DIXF had created records for my imported items, but the field ‘InventDimIdDefault’ was blank. With items created using the AX client (and which did not have a default site defined) this field contained the value ‘AllBlank’. I decided, for a quick fix, to add these three fields to my import. In the AOT, I opened the table DMFProductEntity and expanded the Fields node. In another window, I browsed to InventItemInventSetup. I dragged the field ‘InventDimIdDefault’ from this table onto the Fields node of DMFProductEntity. This created a new field in DMFProductEntity called ‘InventDimIdDefault’. I renamed it ‘InventItemInventSetup_InventDimIdDefault’. I repeated this for the other two tables, and compiled DMFProductEntity. This caused three new fields to be created in the Product’s Staging table.
DMFProductEntity
Adding fields to DMFProductEntity
In the Product CSV file that I was importing, I added three columns with the names ‘InventItemInventSetup_InventDimIdDefault’ etc. In each column, the values in all records were set to ‘AllBlank’. In DIXF, I opened my Processing group for the Products import and hit ‘Entities’. I then hit Generate source mapping and confirmed I wanted it to generate from scratch. This ensured the new fields in my data were mapped to the new fields I had created in the Staging table
Staging table mapping
The new fields are mapped to the staging table
Still in DIXF, I then found the ‘Product’ Target Entity and hit ‘Modify target mapping’. I did ‘Refresh diagram’, and then switched to the ‘Mapping details’ view. I hit ‘Generate mapping’, confirming that I wanted to generate the mapping from scratch. When this was complete, I scrolled down to confirm that my three fields were mapped to ‘Target fields’ with the same names.
Target mapping
The new fields are mapped to the target
I then ran the import, and found this time that I was able to use the Default Order Settings form as expected on my newly imported items. Perhaps I shan’t bother logging it with Microsoft after all!

UPDATE 13th March 2015: I notice that Microsoft have released a hotfix for Dynamics AX 2012 R3 which sounds like it resolves this problem with the Products entity in DIXF:
KB 3047371: Cannot edit default order settings after importing product data by using Data Import export framework (DIXF)

UPDATE 16th June 2015: I notice that Microsoft have released a related hotfix for Dynamics AX 2012 R3 for a problem with the ‘Item’ entity in DIXF. It seems AX will assume the InventDim record which has no inventory dimensions is ‘AllBlank’, even if it is not:
KB 3069778 : “item” Target entity import using DIXF assumes that the blank INVENTDIMID is “AllBlank” without interpreting what is in the blank INVENTDIMID record for the company that you are importing into

DIXF error after changing Licence Configuration

If you’re using Data Import/Export Framework and the supplied entities you may experience the following error:
SysDictTable object not initialised
‘SysDictTable object not initialised’ error
This example appeared when attempting an import using the ‘Product’ entity. The full text of the error is:
SysDictTable object not initialised.
Stack trace
(C)\Classes\DMFEntityWriter\write – line 244
(S)\Classes\DMFEntityWriter\runOnServerWriter – line 14
(C)\Classes\DMFEntityWriter\run – line 98
(C)\Classes\DMFEntityWriter\main – line 24
(C)\Classes\xMenuFunction\run
(C)\Classes\MenuFunction\run – line 85
(C)\Forms\DMFWriteData\Designs\DesignList\DMFEntityWriterBatch\Methods\Clicked – line 23
The problem is caused when the entity contains fields which do not exist in the database. And that can happen when you’ve altered the Licence Configuration or Licence Information to remove functionality; in this example, I had disabled Retail functionality and functionality for several different regions.
It is possible to get DIXF to regenerate the field mapping, which will cause the fields that no longer exist to be removed. To do this, open the ‘Target Entities’ form. From the list, select the entity that gives the error and click ‘Modify target mapping’. Now you must switch to ‘Mapping details’ and then click ‘Generate mapping’. Click ‘Yes’ to generate mappings from scratch. The list of fields in the bottom part of the form will update; in my example fields like InventTable.AssetGroupId_RU and InventTableModuleInvent.MaxiRetPrice_IN disappeared.
This may be enough to solve the problem. In my example, it was not. Checking the entity structure for the ‘Product’ entity (‘Target Entities’ -> ‘Entity structure’) I saw that datasource ‘RetailInventTable’ was listed.
Product Entity Structure
The ‘Product’ Entity Structure
I knew that all Retail functionality was disabled, but the Entity structure cannot be altered from within this form. You can alter the Entity structure from within the AOT. If you browse the contents of table ‘DMFTargetENtityHierarchy’, you can filter by the entity you are interested in (column ‘QueryName’). Here, I can see the record for ‘RetailInventTable’, and I am able to delete the record using Alt+F9:
DMFTargetEntityHierarchy
DMFTargetEntityHierarchy filtered to show the Product entity
Once this is done, I am able to successfully import Products.

Friday, March 18, 2016

Thursday, March 10, 2016

How to Disable Creating New Vendor button on Procurement & Sourcing Module in Ax 2012

How to Disable Creating New Vendor button on Procurement & Sourcing Module in Ax 2012

GOTOà VendTableListPageInteraction Class àInitializedmethodà Write this below code :



this.listPage().actionPaneControlEnabled(formControlStr(VendTableListPage,Newvendor),false);


// here NewVendor is an button name  of formcontrol of VendTableListPage

Compile forward the VendTableListPageInteraction Class ,
Now open the All Vendors & see the following



Wednesday, March 9, 2016

How to retrieve multiple selected records from Grid using X++.

http://yasirnedian.blogspot.in/2012/07/how-to-retrieve-multiple-selected.html

similar Links:http://devexpp.blogspot.in/2013/06/get-selected-records-on-grid-datasource.html
Hi,

In this post, we discuss how we can retrieve all selected(marked) records of a datasource or retrieve marked records form Grid.
For this purpose follow the steps listed below.
  1. Create a new table named "Student" that contains two string fields i.e. Name & ID.
  2. Create a new form and add the newly created "Student" table in the datasource node.
  3. Next create a new button on the form, set its multiselect property to "Yes" . Now override the clicked method of the button and add the following code.
Code snippet

    int             recordsCount;
    Student     studentLocal;
    super();
    
    recordsCount = student_ds.recordsMarked().lastIndex();  // Total number of marked records.
    studentLocal = student_ds.getFirst(1);
    
    while (studentLocal)
    {
        info(studentLocal.Name +" " +studentLocal.ID);
        studentLocal = student_ds.getNext();
    }




Display image for an item in PurchTable in AX 2012

In the PurchTable form create a new tab page image in the line details and whenever any line is created then corresponding image for that item should be displayed in the newly created tab page image.

1) First of all check whether any image is attached for an item or not ?

To attach an image for an item :

Goto production information management -> common -> released products ->

select any item and click on the product image button in the product tab -> document handling of item number form is opened.
click on new -> select type embedded it opens attach file window -> select the image -> click ok.
refresh the page -> image is added to the item.

2) PurchTable -> design -> add tabpage image under line details tab and add window control under it and name it as image.

3) In the form methods create a new method showImage as shown below.

public void showImage()
{
    Image   itemImage;

    productImageRecId = InventTable::find(PurchLine.ItemId).RecId;

    if(productImageRecId)
    {
        select ecoResProductImage where ecoResProductImage.RefRecId == productImageRecId
        || ecoResProductImage.RefRecord == productImageRecId;

        containerImage =  ecoResProductImage.ThumbnailSize;

        itemImage = new Image();
        itemImage.setData(containerImage);
        Image.image(itemImage);
        image.widthValue(itemImage.width());
        image.heightValue(itemImage.height());
    }
}

NOTE :  image is the window form control whose auto declaration is set to yes.

4) PurchTable -> Datasource -> PurchLine -> Methods -> active

In this method call the form method as element.showImage();

Thats it , the image will be displayed on the purchTable form.

SimilarLink:
http://usamaganatra.blogspot.in/2011/08/using-custom-image-resource-in-dynamics.html

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...