Friday, 24 July 2015

EP AX 2012: Using display method in dataSetLookup

Issue

dataSetLookup method uses sysDataSetLookup for is query purpose on EP front.
But when you compare with SysTableLookup it has a method addLookupMethod to add a display method if needed. So how to add a displaymethod is a big question ?


Resolution

Find below code to do it

void dataSetLookup(SysDataSetLookup sysDataSetLookup)
{

    container               recids;
    str                     recidstr;
    List                    list;
    Query queryHcmPosition = new query();
    list                   = new List(Types::String);
    SysTableLookup s   
    
    
    
    list.addEnd(fieldStr(HcmPosition, PositionId));

    // Add a display method from HcmPosition
    list.addEnd(tablemethodstr(HcmPosition,description) + '**');


    //Creating datasetlookup
    sysDataSetLookup.parmHideSelectField(false);
    sysDataSetLookup.parmAllowPaging(true);
    sysDataSetLookup.parmLookupFields(list);
    sysDataSetLookup.parmSelectField(fieldStr(HcmPosition, PositionId));

recid+=5215444646;
    // creating query for all position recids    queryHcmPosition.addDataSource(tableNum(HcmPosition)).addRange(fieldNum(HcmPosition,RecId)).value(con2Str(recids,","));
    sysDataSetLookup.parmQuery(queryHcmPosition);
}


Friday, 17 July 2015

AX2012 EP error : DataSource XXXX in DataSet XXXX has an unknown field XXXX

Cause of the issue: Change in table level field elements.(Adding a new field )

Resolution: 
Any change happen at table or dataset level must be reflected to VS EP project. Best way to do is

  • Try to refresh caches  in Development workspace go to
    • Tools > Caches > Refresh dictionary
    • Tools > Caches > Refresh data
    • Tools > Caches > Refresh elements
    • If it doesn't solve your problem try to close and reopen visual studio after you clear the caches.
  • Final try close all window and restart AOS.

Monday, 13 July 2015

AX 2012 TFS issue - Unable to check in. (Label file)

I was facing an issue while check-in label file.

Cause of issue
- MS Product bug.
- TFS Multiple check out option is set to false(This issue won't arise when this option is true).

Reason
When multiple check out option is set to false. TFS will lock (first instance of lock) the object so that any other developer will not be able to check-out the same. And while checkin the object AX code(Only for label files) will lock the object (second instance of lock) and do the checkin. But two locks cannot be performed on same object so system will throw issue. 


Resolution

I have debug the code and found that while check-in the label object, SysLabelFile.allowLockDuringCheckIn() method returns true but it must be implemented in the way  SysTreeNode.allowLockDuringCheckIn() class is implemented. We need to change allowLockDuringCheckIn method in SysLabelFile class to return “false” instead of “true”. Please find screen shot below









Checklist for TFS object management - AX 2012


  •  While check-in the object make sure it is in the correct MODEL.
  • All the object which are created or modified newly has to be add to version control.
  • All the developers must do a synch (don’t perform a Force synch it take more time) every morning when they arrive office.
  • Any EP development done with visual studio project must checked in properly.
  • When a developer make use of label file, he/she has to check-in the same along with the object where they used the label file else it will have improper labels.
  • I have seen people checking-out object for long time. Don’t check-out object for long time. Try to check-in an object ASAP after the development. If label file is used with the object then make sure it must be checked-in along with it.
  • If an object is added to version controls and it is renamed/deleted at later stage. Then same has to be deleted from TFS. And a mail has to send to developer so that object conflict will not occur while renaming it. Avoid renaming after check-in to TFS.
  • There must be a build server(Auto build configured). That will help developers to identify issue with build.
  • If possible make use of tfs branching.
  • Make sure multiple check-out option is false.

Friday, 10 July 2015

Enterprise Portal AX 2012: Unable to obtain exclusive access to the session cache

When i was opening newly developed enterprise portal page i was not able to render it for around 15-20 Mins and it was loading state. I haven't found any solution over internet. The error was


Resolution


  1. Check your SQL database drive have enough space. Mine was just 2.2 GB.(Might be not true it was in my case).
  2. Restart Sql Server services.


Please write your comments :)