Tuesday, March 22, 2016

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

Monday, February 15, 2016

Display and Edit methods : in ax 2012

Display and Edit methods  Examples:
First Create 3 methods in CustTable as following:

1)
display CustBankAccountId displaybankgroup() // to display bankaccountid
{
    CustBankAccount custBankAccount;
    BankGroup            bankGroup;
   // BankAccountTable bankAccountTable;
    ;

 /*   select accountid from custBankAccount
        where custBankAccount.CustAccount==this.AccountNum ;
    return custBankAccount.AccountID;
 */
   return CustTable::find(this.AccountNum).BankAccount;
}


2)
display Name displayname() // to display name
{
    DirPartyTable dirPartyTable;
    CustTrans       custtrans;
    Name               name;
    ;

    name = CustTable::find(this.AccountNum).name();

    //info(name);
    /*select Name from dirPartyTable
        where dirPartyTable.RecId==this.Party;
    return dirPartyTable.Name;
    */
    return CustTable::find(this.AccountNum).name();
}

3)
public edit Name editname(
    boolean _set,
    CustTable _CustTable,
    Name _name
    )                                               // To display name and also we can the Edit name 
{
    DirPartyTable dirpartytable;

    if (_set)
    {
        ttsBegin;
        dirpartytable = DirPartyTable::findRec(CustTable::find(this.AccountNum).Party,true);
        dirpartytable.Name = _name;
        dirpartytable.update();
        ttsCommit;

    }
    return  _CustTable.name();
}




N ow Create a new Form like below:

 

























Add the fields like above in grid set datasource as custtable and  fill the datamethod property of all fields respectively








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 ...