Search This Blog

Friday 2 January 2015

Progress Bar Indicators in Microsoft Dynamics AX 2012

To perform some data processing that takes large amount of time for example uploading data from Excel or exporting data to excel.We can show the progress bars to the users that data processing is under progress and remaining time etc.

Below is the link which shows the examples on how can we use the progress bars in Microsoft Dynamics Ax 2012:

http://msdn.microsoft.com/en-us/library/aa841990.aspx 

Thanks

Muhammad Zahid.

Friday 26 December 2014

Saturday 11 October 2014

Create First Custom Service In Microsoft Dynamics AX 2012

There is very good blog available for creating the Custom Services in Microsoft Dynamics 2012.

http://sumitsaxfactor.wordpress.com/2012/05/19/create-your-first-custom-service-ax-2012/


One thing I just wanted to mention here that is not given in this blog is:

While consuming your newly created service outside AX in your C# or any other code you need to specify the company name in which your x++ service code will execute.

if just pass the code as mention in above blog post i.e

string[] custIds = servClient.retrieveCustomerNames(new SamCustomAXService.CallContext(), strItem);  

than your code will run in dat company which by default set in AX and it contains no data therefore it will not return any data which you want.

To run your x++ service code in your specified company than you have to create the object of call context and in that object specify your company. You can see the below code for reference.

In my case I have specified the ceu company.

 mzkCustomerService.CallContext context = new mzkCustomerService.CallContext { Company = "ceu" }; 

and than pass this context object in your code as below:

string[] custIds = servClient.retrieveCustomerNames(context, strItem);  
 

This was all related to the Custom Services.

Thanks

Muhammad Zahid.

Friday 26 September 2014

Calling menu item through code with arguments in Microsoft Dynamics AX 2012

Below is the code for calling the menuitem with arguments:

MenuFunction menuFunction;
Args args = new Args();
args.record(CustTable);
menuFunction = new MenuFunction(menuitemDisplayStr(MzkCopyCustomer),MenuItemType::Display);
menuFunction.run(args);

Thanks

Muhammad Zahid.
 

Thursday 25 September 2014

Remove Dynalinks Between Forms in Microsoft Dynamics AX 2012

Some times when we open the child form from another form than the datasource of the child form is sync with the previous form this is due to the dynalink between these two forms and all the data is shown on the child form.

you can use the below code on the init method of the child form after the super() to remove the dynalink between these two forms.

DataArea_DS.query().dataSourceTable(tableNum(DataArea)).clearDynalinks();
UserDataReaFilter_DS.query().dataSourceTable(tableNum(UserDataAreaFilter)).clearDynalinks();

The above two datasources are the datasources of the child form.

For info related to the dynalink you refer to the below link.

http://dynamicsuser.net/forums/p/40062/205388.aspx

Thanks

Muhammad Zahid

Select Marked Records From Grid in Dynamics AX 2012

Below is the Form in which I have selected the three records from the Grid:











Below is the code getting the selected records on the close ok method.

DataArea dataArea1;

dataArea1 = DataArea_DS.getFirst(1);
while(dataArea1.RecId != 0)
{
     info(strFmt('%1,%2',dataArea1.id,dataArea1.name));

    dataArea1 = DataArea_DS.getNext();
}

Below is the result after pressing the ok button on the form.

The records that we have selected will be printed.




















This was all related to this.

Thanks

Muhammad Zahid.

Show or Hide The CheckBoxes On Grid

To show or hide the checkboxes on grid on form you have to set the property "ShowRowLabels" of the Grid.

if the the property ShowRowLabels = yes.Than form grid will look like this:

 


















if the the property ShowRowLabels = no.Than form grid will look like this:




















Thanks

Muhammad Zahid.