Search through blog..

Tuesday, December 10, 2013

Things to know: Upgrade RAM in your Desktop

Today, I have tried to upgrade RAM on my server and faced some challenges as the server is not recognizing the new RAM, I have added. So I did some googling and found some important and crisp information. So would like to share the same for everyone's convenience. 

The below youtube links are all what you need in order to understand what and how you need to do a RAM upgrade in your desktop machine or a laptop. 

  1. Introduction to RAM (Memory) - Video link 
  2. Features and types of Memory - Video link
  3. Upgrading Memory in your Desktop - Video link 
  4. Upgrading Memory to Desktop and a Laptop - Video link
Like mentioned in the video links, the sites and tools you must use before you make the decision of either buying or upgrading your RAM are: 
  1. www.crucial.com 
  2. www.cpuid.com 
Hope this helps. Good luck. 

Sunday, December 1, 2013

What are Containers in AX 2012?

In X++, container is one of the primitive (value) types. A container can contain an ordered sequence of primitive values or other containers.

A container can be used as one of the column types that you can select when you add a new column to a table in AOT. Thereby, it can be stored in the database.
Container is not a class. Containers can be said to be similar to an arary or List/stack classes. But with Containers you can never change size or content of an existing container.

Another interesting thing about containers is that they are immutable. Even though few X++ statements in the System code appear to modify a container, they are actually internally building a new container and copying values as necessary. Even an assignment of a container to another container variable creates a new copy of the container. Because of all this, usage of containers are said to have performance implications.


The X++ function conPeek returns an anytype type. The flexibility of anytype makes container a good way to store values of different types together. This makes it easier to read the values from a container when you do not know what type each value is. An anytype can be assigned to any X++ value type, as long as the value can be converted.

Quick summary:
A container is best suited for processes that do not involve excessive modification to the size or contents of the container.
A container is helpful when you must pass a variety of value types between the client and server tiers.
A container is a poor choice when you intend to repeatedly add to a list in a loop.

Monday, August 5, 2013

Use Temporary Table in AX 2009

Temporary table(Table whose property temporary set to "yes") is not persistent media , so at run-time you have to populate the temporary table and attach the same to the form/report.
For illustration purpose ,I am using inventTable data and attaching the items whose group is Parts.


Steps

1. Create temporary table as TmpTestTable with 3 fields(ItemId,Itemname,ItemGroup).
2. Create a form as TempTestTable and attach the table as datasource
3. Create a new method on the form and copy the following code

TmpTestTable populateRecords(ItemGroupId _itemGroupId)
{
TmpTestTable tmpTable;
InventTable inventTable;
;

while select inventTable
where inventTable.ItemGroupId == _itemGroupId
{
tmpTable.Itemid = inventTable.ItemId;
tmpTable.ItemName = inventTable.ItemName;
tmpTable.Itemgroup = inventTable.ItemGroupId;
tmpTable.insert();
}

return tmpTable;
}


4. Call the above method in init() after super as belowpublic void init()
{
super();

// Call the setTmpData method to attach records to datasourceTmpTestTable.setTmpData(element.populateRecords("Parts"));
}


For details about Types of Temporary tables in AX 2012, check this post.

Friday, July 5, 2013

What to do:Error to navigate to the report server, enable remote errors

Today I was working on SSRS report changes and everything went fine in the DEV environment. And the code changes had to be moved to UAT environment. However, even after a successfully deployment of the report, I was getting the below error when I was trying to view report from AX Form.

Error message: "For more information about this error navigate to the report server on the local server machine, or enable remote errors"

Why do we get this error: Most probably there are two reasons,
1. There is some error in the .net code
2. The IL code is not reflected with the .net code changes made for the report.


Suggested solution approach:

I have approached the troubleshooting in the below order,
1. Compile the objects
2. Generate Incremental CIL
3. Redeploy the SSRS report.

Ideally you should be able to run the report, if the issue was with IL code not reflecting with your code changes.

Hope this helps. Good luck!

P.S. In case you are not able to resolve the issue with the above steps. Trying to enable remote errors and you will receive a detailed error report instead on just an simple Infolog message.
Steps to enable Remote errors can be found In here.

Sunday, April 7, 2013

Ax 2012 SSRS Reporting concepts

The SSRS reporting concepts are very well explained in the below link, you can go through the same for a good understanding of SSRS with Dynamics Ax.

Below are few important related points listed and also the Reporting Services Overview slide.


Reporting services overview
The picture is self explantory and just to brief things up:
  • Basically a Report Model can contain Reports, Layout Templates, Table Style templates, Report Database etc..
  • And nodes which we can find under Report/Report Model are Datasets, Desgin, Parameters, Data methods and Images.
  • In Ax terms, a Datasets can be said to be a data source and collection of fields from data source.
  • And basically an Ax Query, SQL Data, OLAP data (cube) and a Data method can act as a Data source for a report
  • Design node of a Report/Report model will contain three major parts, namely, Header, Body and Footer.
  • And the Desgins can be of two types, namely Auto Design and Precision design.
    Dynamics Ax will take of the conversion form the Designs to RDL files, the format in which reports are stored in the SQL Database.

Internal links:
SSRS Ax 2012: How to create a simple SSRS report - Link
SSRS Ax 2012: How to design reports with built-in templates - Link

Information collected from:
AX2009 SSRS 4 AX SSRS Reporting Concepts - Link

Saturday, April 6, 2013

SSRS Ax 2012: How to design reports with builtin templates

We have already created a very simple and basic report. For more details look at the Internal links listed below. And now we are going to make our report look better.

And the simplest way to have the reports to have standard look and layout is "to set AutoDesign's several properties"
AutoDesign has a property called Layout template, and
DataRegion (CustTable) has a property called Style template.
By modifying these two properties we can actually have a better look and feel for our report.

Layout Template:
This can be found under properties for AutoDesign node. When I click the comboBox to see the options avaliable for LayoutTemplate, I see the below and I choose "ReportLayoutStyleTemplateNoCompany".



Lets see what changes does it make to my report.
The report looks much better now. The Header and the Footer of the template have been automatically designed to somewhat similar to standard Ax reports.



Style Template:
This can be found under properties for the DataRegion node (CustTable in this case). And when I click the comboBox to see the options avaliable for StyleTemplate, I see the below options and I choose "TableStyleAlternatingRowsTemplate"


Lets see what changes does it make to my report.
The report looks even better now. The data grid which was not formatted in the above screenshot, looks much better now and very well readable.


Remember, the templates which we used will mostly make changes to the Font of the text in the report, also text colours.. but doesn't manage the column widths, we will see how it is done in the next posts.
And so this is how we can design the reports which we create using the built-in templates. Good luck!

Internal links:
SSRS Ax 2012: How to create a simple SSRS report - Link

Information collected from:
AX2009 SSRS 3 Better Looking Reports with Templates - Link

SSRS AX 2012: Why and how is a Parameter added to report

If we look at the Simple SSRS report we created using dataset CustTableSRS (use below internal link for more details), we observe that while rendering the report - we had to enter a value in the parameters tab. i.e, Value for CustGroup.
So how and why does this value appear?

How does this parameter appear:
The answer can be found if we go to AOT in Dynamics Ax Client. Open the query CustTableSRS which we used as a Dataset for our report.
In the CustTableSRS AxQuery, we find several nodes. Lets concentrate on the DataSources node.

And in the Datasources node, we can find the CustTable from which the data into the report has be rendered from. And we can also see the Fields, AccountNum & CustGroup, which were displayed in the report.

Now if you look at Ranges, we see that CustGroup lies here. That means, the query has a range and is defined by CustGroup.
And this is how the CustGroup parameter is shown and is required while rendering the report.

Why does the parameter appear:
The basic reason, or should say purpose of the CustGroup parameter is - it acts as a filter. If you select CustGroup as 20, all the records with CustGroup as 20. And if you select any other value in CustGroup, all the related fields are shown.

But the actual and main reason for the need of parameter in report is a performance and efficiency reason. Because, we could have defined our own filter in the report to filter the data to any particular scenario. But then what we would have done is we would load all the data and then filter on that data that is on the SSRS server.
But by using the range on the query, means that, the AOT transfers the data after applying the range on the data and then send it to the SSRS server to be rendered on the report. So that way less data is transferred across. So that is the advantage and proper use of Ranges, a.k.a parameters for reports.


Internal links:
SSRS Ax 2012: How to create a simple SSRS report - Link

Information collected from:
AX2009 SSRS 2 The Case of the Mysterious Parameter - Link

SSRS Ax 2012: How to create a simple SSRS report

This is an attempt to create the simplest SSRS report for Dynamics Ax.
And to start with, lets see what all tools I am using.
  • Microsoft Dynamics Ax 2012 R2
  • Visual studio 2010 Ultimate
  • Visual studio tools (Dynamics Ax Component)
  • Microsoft SQL 2008 R2
Steps to create the simplest SSRS Report:
  1. Launch Visual studio.
    Create a new project and select Template "Microsoft Dynamics Ax" and select Report Model.
  2. And in the Solution explorer, you will find a ReportModel.
    You will need to Add report, by clicking the Add button shown in the below image and then selecting Report. Then you will see a new report "Report1" as shown.
  3. If you double click the Report1. Then you will see something like a part of AOT in Dynamics Ax as shown.
  4. The nodes available under the Report1 are Datasets, Desgins, Images, Data methods & Parameters. And for a simple SSRS report, our task will be to create something under the Datasets & Designs and then bind the two.
    Dataset - would be a tabular set of data that we will get from Ax. We will use Ax queries to get the data for this example.
    And Design is a layout - a page where we will put in the design and map the dataset to a table or something.
    And we should be able to generate a report. Not so beautiful report but a simple SSRS report to start with.
  5. To create a new dataset, Right click on the Datasets node and Add Dataset. Rename the newly created Dataset to any appropriate name.
  6. And in the properties window of the newly created dataset, set the query to an Ax Query by using which the report will actually fetch the data and display. We have bunch of other options which can be customized as well.
    For selecting query, click on the ellipses and then select appropriate Ax Query ( I selected CustTableSRS and then click next to navigate to a window to select fields needed (illustrated in below figure)
  7. Select all fields and click ok. And you will find a query automatically populated in the Query property of Report1. Something like, SELECT CustTable.1.AccountNum,CustTable.1.CustGroup FROM CustTableSRS.
    And also the fields will shop up under the Fields node.
  8. So now we have the dataset populated and fields shown in place. The next step would be to create the design.
  9. And the simplest way to create a design is to drag the dataset into the Designs node. By doing so, you will actually generate an Auto-Design "AutoDesign1"
  10.  And once the AutoDesign is created you are ready to go. You can render the report by Right clicking the AutoDesign1 > and click Preview.
  11. In the opened Report1 preview, enter the parameters needed. In this case, select some value for the CustGroup, say, * (to select all values).
  12. And click Report Tab, to view the report as below.
So that is how we can create a report, a very simple, basic and a quick report using Visual studio 2010 for Dynamics Ax 2012. 

Information collected from:
AX2009 SSRS 1 Create the Simplest Possible Report with Visual Studio – Link

Sunday, March 10, 2013

What to do: Only integrated security is supported for AX queries

In Dynamics Ax 2012, Microsoft SQL Server Reporting Services (SSRS) is the primary reporting platform. So all the default preconfigured reports that are shipped with Microsoft Dynamics Ax run on the Reporting services platform.

And therefore, the below installations should be done perfectly:
  1. SQL Server Reporting Services (SSRS - Part of SQL Installation)
  2. Reporting Server extensions (Business Intelligence components of Microsoft Dynamics Ax)
If your installation went wrong somewhere, then there is a chance that you might get the error: Only integrated security is supported for AX queries when trying to open an report in Ax 2012.

Or you might see that the report will be opened, but you will be asked to enter the username and password to proceed further. Below is the related screenshot:

Solution if error occurs for a single report:
  1. Identify the Report name
  2. Open Reporting Services Configuration Manager ( All Programs > Microsoft SQL Server 2008/2012 > Configuration Tools > Reporting Services Configuration Manager)
  3. Go to "Report Manager URL" Tab and click on URL
    Typically, URL will be in the format http://<ServerName>:80/Reports
  4. Select the particualr Report under DynamicsAx Folder
  5. In the opened page, select Data Sources on the left pane.
    And apply Windows integrated security and click Apply.
  6. Now the report should be opened automatically without any error message and also shouldn't ask for any username and password.

Solution if errors pops up for all SSRS Reports:

You can still apply the above approach for all the reports and it will work. But that is not the right approach for obvious reason, will take a lot of time to do that.
More appropriate solution would be to delete all the reports and redeploy all the reports. Steps are as follows:
  1. First step is to delete all the existing SSRS Reports. For doing this you can navigate to DynamicsAx folder and delete the entire folder.
  2. Then go to Report servers form in Dynamics Ax 2012 and click on "create report folder" button to create the Folder DynamicsAx again.
  3. Now you can open Powershell (Administrative Tools > Microsoft Dynamics Ax 2012 Management Shell). Make sure you run Powershell as Administrator.
  4. Deploy all the reports with the help of command:
    Publish-AXReport -ReportName *
  5. And once, all the reports are deployed you should be good to go.
Hope this helps !!

Saturday, March 9, 2013

How to Limit SQL's Memory usage

If you are working with a Dynamics Ax 2012, you would need SQL 2008/2012 to have the database in it. And if you have a Development or a Test environment, you tend to put both SQL and Dynamics Ax in the same Machine. And that is when this post can help you.

I have Dev machine in my local box along side Dynamics Ax 2012 and many other applications. And even though I am not using Major applications I see that the Memory usage of my box goes real high. And I understood that this is because of Microsoft SQL.
Microsoft SQL tends to eat up as much as memory it can get whenever memory is free, and thereby, causing less memory for other applications when needed.

Solution for that would be to limit the Memory usage of SQL to a certain amount based on your usage of SQL. I use SQL only to store Dynamics Ax 2012's data and the memory required for SQL to manage the transactions to and forth Dynamics Ax isn't much. So I limit the memory usage of SQL server to 1024 MB and thereby increase the performance of my Dynamics Ax 2012.

You can limit SQL's memory usage by following below steps
  1. Open your SQL Server with Administrator permissions (Right click > Run as Administration)
  2. Connect to your SQL instance
  3. On the SQL connection node > Right click > Select properties
  4. In the opened "Server properties" window Select Memory from the left pane
  5. Enter desired amount of memory (in MB) as the limitation for SQL Server to use.
  6. Click Ok to apply and you are good to go.
Result of this immediately I clicked Ok button is shown as below. I didn't open any other application, but for SQL Server and the memory usage will dropped to pretty reasonable amount.

Hope this helps !!

Thursday, March 7, 2013

Managing integration ports [AX 2012]

What are Integration ports?
 

Integrations ports are basically the inbound or outbound ports through which external applications can communicate with Dynamics AOS via AIF (WCF).
 
The exchange of data between External/Internal application is divided into:
  1. InBound Exchange 
    • Both Basic and Enhanced Integration ports can be used.
    • Basically to Receive data and create in Ax
  2. OutBound Exchange 
    • Only Enhanced Integration ports can be used.
    • To Send data to ext. applications
    • To Send data to ext. applications in response to their Requests
 How to: Create a Basic Inbound Integration Port [AX 2012]
 
Basic port is used to test the operation of a custom service that does not require any data processing or exposure to the Internet.
Only a developer can create a new basic integration port
  
To create a basic inbound port

  1. Open the Application Object Tree (AOT).
  2. Right-click the Service Groups node, and then click New Service Group.
  3. Right-click the new service group, and then click Properties. Set the Name property to TestBasicPortServiceGroup. Click Save.
  4. Right-click TestBasicPortServiceGroup, and then click Open New Window. Drag one of the custom services from the Services node onto TestBasicPortServiceGroup.
  5. Right-click TestBasicPortServiceGroup, and then click Save.

6. Right-click TestBasicPortServiceGroup, and then click Deploy Service Group.

 


7. After the service group is successfully deployed, a confirmation message appears in the Infolog. And the TestBasicPortServiceGroup port is appended to the Port Names list as a port of the Basic type.


8. To view the basic port you have created, open the Inbound ports form. Click System administration > Setup > Services and Application Integration Framework >Inbound ports.
The TestBasicPortServiceGroup port appears in the Port Names list as a port of the Basic type.


Important: To start this service every time that the AOS is restarted, set the AutoDeploy property for the service group to Yes.


How to manage the Enhanced integration port:

#1: To create an enhanced integration port, follow these steps.

1. To create an inbound integration port, open the Inbound ports form. Click System administration > Setup > Services and Application Integration Framework > Inbound ports.
–or–
To create an outbound integration port, open the Outbound ports form. Click System administration > Setup > Services and Application Integration Framework > Outbound ports.

2. Click New.

3. Enter a name and description for the new integration port. The name of a port must begin with a letter and can contain only alphanumeric characters.



4. Configure the integration port
Click service operations – to select Service operations which you want to perform using this Enchanced port.
Close Select service operations form.



5. Or just click Close to save the default configuration and you can modify the configuration later.

6. Click button Activate


Important:
If you activate or deactivate an integration port, all integration ports on that particular instance of AOS are reactivated. Do not click the Deactivate/Activate button while integration ports are processing messages.

#2: To Edit or delete an enhanced integration port, follow these steps:

To change the settings for an existing enhanced integration port, or to delete the port, you must first deactivate the port.

1. Identify and select the particular Port name field you want to change or delete.

2. Click Deactivate to deactivate the port.

3. Change the configuration settings.
–or–
Click Delete to delete the port.

4. Click Activate to reactivate the integration port.


#3: Configure addresses for Enhanced Integration ports:

Enhanced integration ports use adapters to enable Microsoft Dynamics AX to communicate by using various transport protocols.
The addresses of integration ports are defined by the adapters that you select and the Uniform Resource Identifiers (URIs) of the adapters.
Inbound integration ports have an inbound address that is used for inbound messages, and they can also have a response address that is used for outbound messages.
Outbound integration ports have only an outbound address that is used for outbound messages.


How to Register Adapaters:
An adapter must be registered before it can be used. Adapters that are included with Microsoft Dynamics AX are automatically registered during installation.

Whenever a new adapter is added to the (AOT), you must register the adapter to make it available in the configuration forms for enhanced integration ports.

To register adapters, follow these steps:

1. Click System administration > Setup > Checklists > Initialization checklist.

2. Expand the Initialize system node.

3. Click Set up Application Integration Framework. By doing so, Adapters, basic ports, and services are registered. This operation can take some time to be completed.


How to select Adapaters:

After adapters have been registered, you must select the adapters that you want to use for integration.

In the Address group or the Response address group, click the arrow in the Adapter field, and then select an adapter in the list.
The list by default consists of:

1. File system adapter – Receive or Send

2. HTTP – Send and receive

3. ISABEL SEPA credit transfer – Receive or Send

4. MSMQ – Receive or Send

5. NetTcp – Send and receive

You can select the appropriate adapter for your connection when you configure an enhanced integration port.

How to Specify URIs
Before you can configure an adapter, you must specify its URI. The format of the URI varies, depending on the type of adapter that you selected:

1. For File system adapter and:

a. Address is an inbound address then the URI is the file system path of the directory where the port retrieves documents.

b. And if the address is an outbound/response address, the URI is the file system path of the directory where the port saves documents.
To select a directory, click the arrow in the URI field, and then browse to a folder.
Notes: Make sure that the service account for Application Object Server (AOS) has the appropriate read or write permissions for the directory.
When you submit multiple documents to a port that uses the file system adapter, the documents are processed in order based on the file names. (Workaround if needed, is to use file names that include a sequencing scheme, such as "PO_0001" and "PO_0002")



 2. For NetTcp adapter, the URI is automatically provided by Microsoft Dynamics AX, based on the port name. You can view the URI after you save the port configuration.


3. For MSMQ adapter, the URI is based on the queue that you select. To select a queue, click the arrow in the URI field, and then select a queue in the list.
The server must be configured to provide Message Queuing services, and queues must be defined before they can be used by the integration port.


4. For HTTP adapter type is HTTP, the URI is the Internet address of a website that you added by using the Web sites form. To select a website, click the arrow in the URI field. Then, in the Select Web site form, click the arrow in the Web site field, and then select a website in the list.




How to Configure adapters:


After you specify the URI of the adapter that you selected, you can configure the adapter.

In the Address group or the Response address group, click Configure. In Microsoft Dynamics AX 2012 R2, for adapter types other than NetTcp, to make the Configure AOS button visible you must save the port first.

One of the following configuration forms opens:

1. For the file system adapter, the File system adapter configuration form opens. The Microsoft Dynamics AX user account that is specified should have required rights. For example, User Account Control (UAC) is enabled in Windows, and files are created by an administrator account. For these files, the Owner attribute in the file properties is set to the Windows Administrators group. Similarly, for files that are created from a process that runs on a network service, the owner is set to NT AUTHORITY\NETWORK SERVICE.

2. For NetTcp, HTTP, and MSMQ adapters which are based on Windows Communication Foundation (WCF), the WCF configuration form opens.

The WCF configuration form contains the WCF Configuration Editor tool, SvcConfigEditor.exe, if the tool is installed. This tool is installed as a component of some versions of the Windows SDK and by Microsoft Visual Studio 2010. This tool provides a graphical user interface (GUI) that you can use to create and modify configuration settings for WCF services.

If the WCF Configuration Editor tool is not installed, the WCF configuration file opens in Notepad. You can change the WCF configuration information by modifying the XML code in Notepad. Then save the file.


Information collected from:
http://msdn.microsoft.com/en-us/library/aa496471.aspx .
To learn more about, Customization of service contracts, Processing options, Troubleshooting and security, please go through the above link.

Sunday, February 17, 2013

Walkthrough: Adding a Page to Navigation [AX 2012]

When you create a page in Enterprise Portal, you will add it to the navigation to enable users to access it. This walkthrough demonstrates how to add the Tutorial_MessagePrompt page to the Quick Launch navigation for the Sales module site in Enterprise Portal. It illustrates the following tasks:
1.      Creating a Web Menu Item
2.     Modifying the Quick Launch Menu
3.     Viewing the Page in Enterprise Portal
Prerequisites to complete this walkthrough: 1.      Microsoft Dynamics AX 2.     Enterprise Portal

#1: Creating a Web Menu Item
A web menu item points to a specific page in Enterprise Portal. You must create a web menu item for each page that you will be adding to the navigation.

To create a web menu item:
1.      In the AOT, expand the Web node, and then expand the Web Menu Items node.

2.     Right-click URLs, and then click New URL.

3.     Right-click the new URL that you created in step 2, and then click Properties.

4.     Set the Name property to Tutorial_MessagePrompt Prompt.

5.     Set the Label property to Message Prompt Tutorial.

6.     Specify the URL property, which has the following form: Module/Enterprise%20Portal/PageName.aspx. The Tutorial_MessagePrompt page is found in the main Enterprise Portal site, so it does not have a Module in its path. The value you must enter for the URL property to access the Tutorial_MessagePrompt page is: http://<<server>>/sites/DynamicsAx/Enterprise%20Portal/Tutorial_MessagePrompt.aspx

7.     Right-click the new URL item, and then click Save.

#2: Modifying the Quick Launch Menu
To add menu items to the Quick Launch area for a module site, you must first determine which web menu resource is being used for the Quick Launch.
To modify the Quick Launch menu:
1.      In the AOT, expand the Web node, expand the Web Modules node, and then expand the Home node.

2.     Right-click the Sales node, and then click Properties.

3.     Examine the QuickLaunch property. It is set to EPSalesQuickLaunch. This is the web menu resource that defines the menu items displayed in the Quick Launch area for the Sales module site. You will add the new web menu item that you created to this web menu.

4.     In the AOT, expand the Web node, and then expand the Web Menus node.

5.     Locate and expand the EPSalesQuickLaunch node.
Right-click the Common node. Click New, and then click Menu item. A new menu item will be added at the end of the list.

6.     Right-click the node for the new menu item, and then click Properties.

7.     Use the drop-down list for the MenuItemName property to select the Tutorial_MessagePrompt menu item you created in the previous procedure.

8.     In the AOT, right-click the EPSalesQuickLaunch Web menu, and then click Save.  

#3: Viewing the Page in Enterprise Portal
After you have added the menu item to the Quick Launch, you can view it in Enterprise Portal.
To view the page in Enterprise Portal
1.      Using a web browser, open Enterprise Portal. The typical URL to access Enterprise Portal is: http://<server>/sites/DynamicsAx/
Substitute the name of the server on which Enterprise Portal is installed.

2.     Click Sales on the top link bar to display the Sales module site.

3.     In the Quick Launch, examine the last item in the Common group. The Message Prompt Tutorial item should be listed.

Important : Sometime you might not see the new item in the list, the caches for Enterprise Portal may need to be refreshed.
And for this, you just have to go to Home and press “Refresh AOD” in the quick launch menu and then you should be able to see your new menu.

4.     Click the Message Prompt Tutorial item to open the Tutorial_MessagePrompt page.

Information collected from: Link

Thursday, February 14, 2013

Walkthrough: Adding a Field to a User Control [AX 2012]

In this example, the customer page in EP displays detailed information about a customer. The User Control displayed in a User Control web part is used to display the data on the page and the AxForm is the main component of the User Control used.

A common customization is adding/changing the fields that are displayed in an entity overview page.
This walkthrough demonstrates how to add a field to the first group that appears on the View customer entity overview page. The below figure illustrates the tasks be performed:


Prerequisites:
Basic prerequisites to be checked and available before proceeding for the walkthrough are:
1. Microsoft Dynamics AX
2. Enterprise portal
3. Visual Studio 2010
4. Visual Studio Tools installed (Ax Installation)
5. EP Administrator rights

#1: Determining the User Control to Modify
Before you can modify the fields displayed on the View customer page, you must determine which User Control is being used for that page.


To determine the User Control to modify:
  • Using a web browser, open Enterprise Portal. << http://<servername>/sites/DynamicsAx/ >>
  • Click Sales on the top link bar, this displays the All Customers list page. Select one of the customers in the list, and then click View. The View customer page with customer information is displayed.
  • In the ribbon, display the Page tab.
    Click the Edit Page command.

  • Locate the View customer web part in the middle column. In the drop-down menu for this web part, click Edit Web Part. The drop-down menu is the small arrow found on the upper-right corner of the web part.

  • In the list of properties for the web part, locate the Managed content item property. It is set to CustomerOverview, which is the User Control that is being displayed in the web part. This is the User Control that will be modified.
  • Click Cancel to close the list of web part properties.
  • Click Stop Editing to return to the View customer page. Close the page.
#2: Creating the EP Web Application Project
Visual Studio is used to modify User Controls for Enterprise Portal.

To create the EP Web Application project:
1. Start Visual Studio. To make sure you start Visual Studio with administrative privileges, right-click the shortcut for Visual Studio and then click Run as administrator.
2. In the File menu, click New, and then click Project.
3. In the New Project window, select .NET Framework 3.5 as the framework version to use.
Important: For this release of Microsoft Dynamics AX, the EP Web Application project must target the .NET Framework 3.5 to work correctly.

4. In the Installed Templates list, select Microsoft Dynamics AX. If you do not see this project template, make sure that you have Visual Studio Tools for Microsoft Dynamics AX installed.
5. Choose the EP Web Application template.
6. Specify a name for the project, and the location of the folder where you want to store the files for the project.
7. Click OK to create the project.

#3:Adding the User Control to the EP Web Application Project
You must add the User Control to the EP Web Application project so that you can modify the User Control's properties.

To add the User Control to the EP Web Application project
1. In the View menu in Visual Studio, click Application Explorer.
2. In the Application Explorer, expand the Web > Web Files > Web Controls node.
3. In the Web Controls list, locate the CustomerOverview control.
4. Right-click the CustomerOverview control, and then click Add to project. The control and several related controls are added to the project.
5. Close the Application Explorer.

#4: Modifying the User Control
Use Visual Studio to make changes to the User Control.

To modify the User Control
1. Locate the CustomerOverview.ascx component in Solution Explorer.
2. Right-click the CustomerOverview component in Solution Explorer, and then click View Designer.
3. After a few moments, you will see several components in the control layout. The AxDataSource component is used to access data for the customer overview page.
The AxMultiSection component contains all of the expandable sections that you see in the View customer page.
The sections contain AxGroup components, which are used to display fields.
4. Click the Customer AxGroup component directly in the layout to select it. This component contains the fields that are displayed at the top of the General section of the View customer page.

5. To modify the fields that are displayed in the group, use one of the following methods:
a. Display the context menu at the upper-right corner of the AxGroup control in the layout. Click Edit Fields to display the Bound Field Designer.
-or-
b. Locate the Fields property in the Properties list. Click the ellipsis button to display the Bound Field Designer.

6. The Selected Field list contains the fields that appear in the group. Only the AccountNum field is included. In the Available Fields list, select the OrderEntryDeadlineGroupId field. Click Add Field to add this field to the list of fields that will be displayed in the group.
7. Make sure that the OrderEntryDeadlineGroupId field is selected in the Selected Field list.
8. In the BoundField Properties list, locate the HeaderText property. Set the value of this property to Order entry deadline:.
9. Click OK to save the changes to the list of fields for the AxGroup.

10. In the File menu, click Save CustomerOverview.ascx to save the changes you made to the User Control. The changes are exported automatically to the AOT. The updated User Control is also deployed to the Enterprise Portal server.

#5: Viewing the Customization in Enterprise Portal
After the field has been added to the User Control, you can view it in Enterprise Portal.

To view the customization in Enterprise Portal
1. Using a web browser, open Enterprise Portal.
2. Click Sales on the top link bar. Display the All Customers list page. Select one of the customers in the list, and then click View. The View customer page with the customer information is displayed. You will see the customer details, including the Order entry deadline field that you added.