Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Friday, April 25, 2014

How to get current company currency through x++ code in AX

Hi,

CompanyInfo::standardCurrency();

Regards,

Form close method sequence in Dynamic AX

Hi,



Before closing the form i.e at the time of closing 

Close - Calls when we click esc / close.
CloseOK – Calls when we click Commandbutton::Ok
CloseCancel – Calls when we click Commandbutton::Cancel
CloseSelect – close the lookup form, and set return value
CloseSelectRecord – close the lookup form, and set return record

After closing the form following action methods calls,

Closed – calls once form closed
ClosedOK – The form was closed by the user clicking ‘OK’
ClosedCancel – The form was closed by the user clicking ‘Cancel’

canClose() is called before any of the close methods get called.
note: this canClose() will be called twice

Regards,

Monday, April 14, 2014

To get time difference in Dynamic AX


Hi,

DateTimeUtil::getDifference(DateTimeUtil::getSystemDateTime(), AnotherDateTime)
//Here time components of both the fields are taken out and its difference is being calculated.

Regards,


Sunday, April 13, 2014

Container and unbounded string (text) fields are not allowed in a WHERE expression in AX.

Hi,

public void init()
{
    str 30             TimeSheetID;
    DNTimeSheet     LocTimeSheet;
    ;
    super();
    // Check for passed arguments
    if( element.args() )
    {
        // get string parameter
        TimeSheetID = element.args().parm();
        select DNTimeSheet where DNTimeSheet.TimeSheetNum == TimeSheetID;
        ProjectIDFeild.text(ProjID);
        info(strFmt(ProjID));
    }
}

Here TimeSheetID thrown this error.
Solution is  just I declared Str 30 TimSheetID instead of Str TimeSheetID

Regards,

How to write methods menu item button (Action pane objects) in the list page in Dynamic AX

Hi,

There are two ways to achieve this, one that very commonly know class called list page interaction class another technique is just change the property of the action pane object.
Just change the display target--  Property from "Auto"  to "Client" 

Now you try to override the method on the action pane object its possible.4


Regards,

Add filter control to the form in Dynamic AX

Hi,
Four method is to be added for achieving this feature in your form
1.  Add modified method the filter field (below code)

public boolean modified()
{
    boolean ret;
   
    ret = super();
   
        Table1_ds.executeQuery(); // Here Table1_ds is the datasource to be filetered
   
    return ret;
}
2.  Add QuerryFilter in global declaration of the form
public class FormRun extends ObjectRun
{
    QueryFilter queryFilter;
}
3.  Override the init method of the concern datasource where record to be filtered.
public void init()
{
    super();
   
        queryFilter = Table1_ds.query().addQueryFilter(Table1_ds.queryBuildDataSource(), "FieldName");
//Same as earlier Table1_ds is the data source and FieldName is the add range to the datasource query.
}
4.   At last add executeQuery for the same datasource.
public void executeQuery()
{
    // Get the filter value from the filter control.
    queryFilter.value(element.design().controlName("FormField").valueStr());
 //FormField is the filter that you added for proving range value in form.
    super();
}
Hope now it filters good.
Regards,


Job to copy all the record from one table to another in Dynamic AX

Hi,

// Copy data from one table to another using job
static void CopyData(Args _args)
{
    CustTable custTable ;
    DuplicateTable duplicateTable ;
    ;
    ttsBegin;
    while select custTable
    {
        buf2Buf(custTable ,duplicateTable );  
        duplicateTable.insert();
    }
    ttsCommit;
}

Regards,

Saturday, April 12, 2014

AX 2012 CIL generation / Err: 351

Hi,

Following step gives optimum solution.

1. Stop the AOS.
2. Delete all of the source in the C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL directory.
3. Start the AOS.
4. Perform a full CIL generation.

Regards,

Thursday, April 10, 2014

How to add user to Business Connector proxy user account

Hi,

Below procedure is for adding user to  .NET Business Connector in Microsoft Dynamics AX.
·         In the Microsoft Dynamics AX client,
Click System administration > Setup > System > System service accounts.
·         In the Business connector proxy section, enter the alias and the domain. The alias must be a domain account.
·         Click OK.


Regards,

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...