Skip to main content

Posts

Showing posts from January, 2012

Retrieving data from AX table in EP

Sometime we are in need of retrieving data from the tables which are not added in form's datasource in EP page. To manipulate the data from tables other than datasource (in EP) or dataset (in AX), following code will work.

Hide Fields in a AxGroup /AxForm in Enterprise portal

There was a requirement to hide/un-hide the fields within AXGroup according to the setup defined in AX form either to show fields or not as per user. protected void AxFrmEmployee_PreRender(object sender, EventArgs e) {     AxForm frm = this.axFrmEmployee;         for (int i = 0; i < this.AxGroup1.Fields.Count; i++)     {         AxBoundField fld = this.AxGroup1.Fields[i] as AxBoundField;         if ((fld != null) && (fld.Metadata.Name == "TitleId"))         {             fld.Visible = (frm.CurrentMode == DetailsViewMode.ReadOnly) ? false : true;         }     } }

Accessing the URL of AxUrlMenuItem from AX into EP (Code behind)

Sometimes we need to change/append the URL defined on AXURLMenuitem in Dynamics AX 2012 in order to open different EP pages based on user selection. Here is the code to  Create the complete URL in code (based On eb Menu Items)      protected override void OnPreRender(EventArgs e)     {                // Get the URL for the webpage that referenced the current record                AxUrlMenuItem url = new AxUrlMenuItem("EPSalesTableInfo");                 // update the hyperlink to point to the URL         hpRecord.NavigateUrl = url.Url.ToString();        // you can use this URL to redirect to any page like        Response.Redi...

Making string field a custom lookup on user selection

Sometimes we just compile our posts to keep the things at one place so we or someone can get it easily when we in need. This post belongs to the same concept :) Requirement was to filter the records in grid according to the selection of base enum values from a lookup. Easy task :) but then I had to make a string field a custom lookup on selection of first value from base enum and to make it a read only on selection of second value of the base enum. This is what I did; Filter: modified public boolean modified() {     boolean ret;     ret = super();     if(str2enum(enum_variable,this.valueStr()) == enum::firstvalue)     {         stringField.allowEdit(true);         stringField .text(' ');     }     else     {          stringField .allowEdit(False);          stringField ....

.NET business connector to access Dynamics AX from .NET world

Few days before I was struggling to import the huge file data from excel into Dynamics AX as AX COM connector is not much powerful to import huge file data from excel. One of mine friends suggested me to go through .Net business connector to achieve the import functionality more quickly. Here is the link which you can also find useful while integrating AX with different .Net based applications. http://blogs.msdn.com/b/cesardelatorre/archive/2007/07/06/accessing-dynamics-ax-4-0-from-net-using-the-dynamics-ax-net-business-connector.aspx