Thursday, 26 February 2015

Refresh Form Automatically After Specific Time Interval In AX2012

Hi Guys,

A requirement in which form automatically refresh after 10 minutes when client restrict without using of Batches functionality.I have achieved this requirement with following steps and share with all of you

All changes performed on Form level methods

Step 1: on class declaration level I have created a macro like this

public class FormRun extends ObjectRun

Step 2: Create a new method at form level like following

void refreshForm()
    this.setTimeOut(identifierstr(refreshForm), #waitTime, false);

Step 3: In this step override run method on form level and your code look like following

public void run()

That's End.

Thursday, 30 October 2014

Optimizing display methods in AX 2012

Check the following link for detail of display method.what developer must be care before using it.

Wednesday, 24 September 2014

Debugging AIF services of Microsoft Dynamics AX 2012 in Visual Studio

If do you want to debug AIF service's in VS  checked following useful links

Thursday, 19 June 2014

Read data from live website in Ax2012

With the help of following code we can easily read data from live website

static void ReaddataFromLivewebSite(Args _args)
    int         curPos=1;
    int         endPos;
    int         startPos=1;
    str         data;
    str         internetURL;
    int         price;
    TextBuffer  textBuffer;
    System.Net.WebRequest request;
    System.Net.WebResponse response;
    System.IO.StreamReader  streamReader;

    response= request.GetResponse();
    streamReader=new System.IO.StreamReader(response.GetResponseStream());
    textBuffer =new TextBuffer();
    data = streamReader.ReadToEnd();
    textBuffer.find('Cash Seller & Settlement', curPos);
    textBuffer.find('3-months Buyer');
    data=textBuffer.subStr(startPos, endPos - startPos);
    data =   strReplace(data,'',"");
    data =   strReplace(data,'',"");   
    data =   strReplace(data,' ',"");
    data =   strReplace(data,'',""); 
    internetURL= strRem(strreplace(data,'Cash Seller & Settlement',''),'"');
    price = str2int(internetURL);
    internetURL = int2str(price);


Tuesday, 10 June 2014

Calculate LabelIds against Label field Id in AX2012 using X++

I have calculated a total number of label id's against Label file id . In my case Label file Id is "NVS".

static void maxLabelIds(Args _args)
    SysLabel   SysLabel;
    int maxLabelId;
    SysLabel =  new SysLabel('EN-US');
    maxLabelId = SysLabel.maxLabelId('NVS');
    print maxLabelId;

Saturday, 17 May 2014

Using AIF Inbound and Out Bound service check Exception in Ax2012

I used AIF inbound service when any error occurred in AIF. Errors did not  shown in exception window of AIF. Errors must be looks like a following screen but in my case it's shown empty.

In my scenario
few lines of code is missing inside this class i.e "AxdLedgerGeneralJournal" in method of "prepareForSave" those lines are following

Find a char in string and replace new char using x++ in Ax2012

In following example we are find a char i.e "," in string and replace this char with new one char i.e ".".

static void FindCharAndRepalce(Args _args)

    str a;
    int pos;
    a     = "100,00";
    pos =  strFind(a, ',',1, strLen(a));
    a     =  strDel(a,pos,1);
    a     =  strIns(a,'.',pos);