Showing posts with label Dynamics AX 2012. Show all posts
Showing posts with label Dynamics AX 2012. Show all posts

Monday, September 2, 2013

Simple UI Builder Class in SSRS Report in AX 2012

This UI Builder class is simple class with less code and less effort. UI Builder Class is needed when you want to customize your dialog which pop ups when you open a Report. UI Builder Class helps you to add run time lookups and other controls on the dialog form.
Step1 : Your Class must extends SrsReportDataContractUIBuilder
class SimpleDemoUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogEmplId;
DialogField dialogName;
boolean enable;
SimpleDemoContract contract;
}// two fields emplId and Name will reflect in the lookup in dialog form at the time of report opening.
Step2 : Override the build method
public void build()
{
contract = this.dataContractObject();
dialogEmplId = this.addDialogField(methodStr(SimpleDemoContract, parmEmplId),contract);
}// this method used for adding the field  which is from contract class.
Step3 : Write this below code to get lookup
private void emplIdLookup(FormStringControl emplIdlookup)
{
Query query = new Query();
QueryBuildDataSource qbds_EmplTable;
SysTableLookup sysTableLookup;
// Create an instance of SysTableLookup with the current calling form control.
sysTableLookup = SysTableLookup::newParameters(tableNum(FilterDemo), emplIdlookup);
// Add fields to be shown in the lookup form.
sysTableLookup.addLookupfield(fieldNum(FilterDemo,EmplId));
sysTableLookup.addLookupfield(fieldNum(FilterDemo,Name));
qbds_EmplTable = query.addDataSource(tableNum(FilterDemo));
sysTableLookup.parmQuery(query);
// Perform the lookup
sysTableLookup.performFormLookup();
}
Step4 : Override this method
public void getFromDialog()
{
contract = this.dataContractObject();
super();
}
Step5 : Override this method
public void initializeFields()
{
contract = this.dataContractObject();
}
Step6 : Override this method
public void postBuild()
{
super();
dialogEmplId = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(SimpleDemoContract,parmEmplId));dialogEmplId.registerOverrideMethod(methodStr(FormStringControl, lookup),
methodStr(SimpleDemoUIBuilder,emplIdLookup), this);dialogEmplId.lookupButton(2);
}
the Contract Class code and DP class have already been added to the blog. please check it for further reference but one important part has to be added to the contract class i.e in class declaration, the following part has to be updated.

[DataContractAttribute,SysOperationContractProcessingAttribute(classstr(SimpleDemoUIBuilder))]

Working with SSRS reports in Dynamics AX 2012

Microsoft Dynamics AX provides a model-based approach for creating reports by providing project templates and modeling tools that are incorporated into the Microsoft Visual Studio development environment. The reporting features provided by Microsoft Dynamics AX are tightly integrated with SQL Server Reporting Services.
Reporting Services is a server-based reporting platform that provides comprehensive reporting functionality for a variety of data sources. The reporting framework includes a set of tools for you to define reports in the Microsoft Visual Studio development environment. The report development experience takes advantage of extended SQL Server tools and components fully integrated into the Microsoft Visual Studio environment. By using the reporting APIs, you can integrate or extend data and report processing in custom applications. The following table provides links to more information on these Microsoft technologies:
You can refere following url for more information about report development with SSRS,Dynamics AX 2012. 

Setting SysEntryPointAttribute for Services [AX 2012]

The SysEntryPointAttribute indicates what authorization checks are performed for a method that is called on the server. This attribute must be set for all service operations. For more information about how to set attributes on X++ methods, see Syntax for Attribute Classes.
The AIF Document Service Wizard automatically decorates service operations with [SysEntryPointAttribute(true)]. When you develop custom services you must use theSysEntryPointAttribute to decorate each service operation.
Setting :
The following table describes the possible values for the constructor of the SysEntryPointAttribute class.
[SysEntryPointAttribute(true)] - Indicates authorization checks are performed on the calling user for all tables accessed by the method.

[SysEntryPointAttribute(false)] - Indicates authorization checks are not performed on any tables accessed by the method.

Example :
[AifDocumentCreateAttribute, SysEntryPointAttribute(true)]
public AifEntityKeyList create(CustCustomer _custCustomer)
{
    return this.createList(_custCustomer);
}

reference : http://technet.microsoft.com/en-us/library/hh801193.aspx

Thursday, August 22, 2013

WINAPI functions and their use

Like most AX developers I use the WINAPI class quite often. Its a very useful class when handling files that need to be accessed outside of the AX environment

  static void FO_WinApi(Args _args)
  {
      str     root        = "C:";
      str     path        = "C:\\dionne";
      str     fileName    = "SalesInvoice.pdf";
      str     fileName2   = "SalesInvoice1.pdf";
      str     file        = path + "\\" + fileName;
      str     file2       = path + "\\" + fileName2;
      int     x, y;
      ;

      // Does folder exist?
      print WinAPI::folderExists(path);

      // Does file exist?
      print WinAPI::fileExists(file);

      // Copy file.
      print WinAPI::copyFile(file,file2);

      // New file exists?
      print WinAPI::fileExists(file2);

      // Delete new file.
      print WinAPI::deleteFile(file2);

      // New file still there?
      print WinAPI::fileExists(file2);

      // Get current cursor position.
      [x, y] = WinAPI::getCursorPos();

      print x;
      print y;

      // Get time and date format.
      print WinAPI::getSystemLocaleDateStr();
      print WinAPI::getSystemLocaleTimeStr();

      // Gets current computer name.
      print WinAPI::getComputerName();

      // Gets total disk space.
      print int2str(WinAPI::getDiskTotalSpaceInKb(root)
             / 1000) + " MB";

      // Gets current free space on disk.
      print int2str(WinAPI::getDiskFreeSpaceInKb(root)
             / 1000) + " MB";

      // Date when file was last accessed.
      print WinAPI::getFileAccessedDate(file);

      // Time when file was last accessed(In seconds).
      print WinAPI::getFileAccessedTime(file);

      // Gets path to temp directory.
      print WinAPI::getTempPath();

      // Gets a generated temporary filename, prefix "FO_".
      print WinAPI::getTempFilename(path, "FO_");

      pause;

  }
In addition to file information the WINAPI class can execute different file types from within Dynamics AX by of course using the file name as a parameter.
For example lets say you want to launch a PDF file saved in table within AX. WinAPI::ShellExecute() will do this for you.
- See more at: http://www.winfosoft.com/blog/microsoft-dynamics-ax/the-winapi-class#sthash.3QzP3keO.dpuf


reference from :http://www.winfosoft.com/blog/microsoft-dynamics-ax/the-winapi-class

Monday, August 12, 2013

AX 2012 : How to create new number sequence ?

Number sequences in Dynamics AX are used to generate specifically formatted numbers for record identification. for example Sales Id, Purchase Id, Journal number etc.
Very often we need to customize functionality which require new number sequence to be generated for new table designed.Dynamics AX contains a list of NumberSeqApplicationModule derivative classes, which holds the number sequence setup data for the specific module. These classes are read by the number sequence wizard, which detects existing number sequences and proposes to create the missing ones or newly added ones.
Suppose we have created new table “KitTable” with fields KitId and KitName, and we have to generate number sequence for KitId. This table belongs to Sales module.
Lets look at the steps to do this job :
1. Open the NumberSeqModuleCustomer class in the Application Object Tree (AOT), and add the following code to the bottom of the loadModule() method:
datatype.parmDatatypeId(extendedTypeNum(KitId));
datatype.parmReferenceHelp(“Kit ID”);
datatype.parmWizardIsContinuous(false);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::Yes);
datatype.parmWizardIsChangeUpAllowed(NoYes::Yes);
datatype.parmWizardHighest(999);
datatype.parmSortField(20);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
2. Create a new job with the following code and run it:
static void NumberSeqLoadAll(Args _args)
{
NumberSeqApplicationModule::loadAll();
}
3. Run the number sequence wizard by clicking on the Generate button inOrganization administration | Common | Number sequences | Number sequences, and click on the Next button, as shown in the following screenshot:
4. Click on Details to view more information. Delete everything apart from the lines where Area is Accounts receivable and Reference is Kit Id. Note the number sequence codes, and click on the Next button.
5. On the last page, click on the Finish button to complete the set up.
6. The newly created number sequences can now be found in Organization administration | Number sequences | Number sequences
7. Open Organization administration | Number sequences | Segment configurationand notice the new Kit Id reference.
8. Open Accounts receivable | Setup | Accounts receivable parameters and go to the Number sequences tab page. Here we should see the new number sequence code.
9. The last thing to do is to create a helper method for this number sequence. Locate theCustParameters table in the AOT and create the following method:
public server static NumberSequenceReference numRefKitId()
{
return NumberSeqReference::findReference(extendedTypeNum(KitId));
}
Now lets see how the above code works :
We added a number sequence initialization code into the NumberSeqModuleCustomerclass. This class holds the initialization of all number sequences that belong to the Accounts receivable module. The code in the loadModule() method defines the default number sequence settings to be used in the wizard, such as data type, description, highest possible number, and so on.
Additional options, such as starting sequence number, number format, and others could also be added here. All mentioned options could be changed while running the wizard. The addParameterType() method is used to define number sequence scope. In the example we created a separate sequence for each Dynamics AX company.
Before we start the wizard, we need to initialize number sequence references. This is normally done as a part of the Dynamics AX initialization checklist, but in this example we have to execute it manually by calling the loadAll() method of theNumberSeqApplicationModule class.
Next, we will run the wizard. We will skip the welcome page and in the second step of the wizard, the Details button can be used to display more options. The options can also be changed later in the Number sequences form before or even after the number sequence is actually used. The last page shows an overview of what will be created. Once completed, the wizard creates new records in the Number sequences form for each company.
The newly created number sequence reference appears in the Segment configurationform. Here we can see that the Data area checkbox is checked, meaning that we will have separate number lists for each company. The number sequence setup can normally be located in the module parameter forms.

Thursday, July 11, 2013

Thursday, April 18, 2013

Duplicate company in AX 2012


The Duplicate Company function in AX 2009 is deprecated in AX 2012, and the reason is "The organization model represents a paradigm shift in Microsoft Dynamics AX 2012", said by Microsoft. To copy a company in AX 2012 for demo or test, now you'll have to
  1. create a definition group
  2. export the def group from old company
  3. import the def group to the new company
When you create def group, go to Include table group tab and make sure you've selected the tables you want to bring into your new company. When you import, go to the Advanced tab and select/deselect the Include shared tables checkbox as it's needed. Microsoft has a very detailed tutorial on this process:

Tuesday, February 5, 2013

How to install Dynamics AX2012



How to Install and Configure Dynamics AX 2012 Components
http://daxdilip.blogspot.com/2011/08/step-by-step-guide-how-to-install.html

Install Dynamics AX2012 Enterprise Portal

http://daxdilip.blogspot.com/2011/08/how-to-install-dynamics-ax2012.html

Install Dynamics AX2012 SSRS And Analysis Extensions
http://daxdilip.blogspot.com/2011/09/step-by-step-installation-dynamics-ax.html

Inside Microsoft Dynamics AX 2012


Inside Microsoft Dynamics AX 2012

Thought to share these Youtube videos on Dynamics AX 2012:

Video1 - Developer Tools
- Stresses the importance of Models
- API's
- Interoperability with .Net
- 3 yrs spent by Microsoft for the new Development Tools
http://www.youtube.com/watch?v=cZc1Jya7tqM&feature=related

Video 2 - Services and AIF
- Heavy investment in Services
- Mobile applications can plug in to the service model
- 90 webservices
- Simplified and Powerful Integration
http://www.youtube.com/watch?v=sn9I6TaQY9o&feature=relmfu


Video 3 - Reporting
- Integration with Excel
http://www.youtube.com/watch?v=qx3_2oSrdpI&feature=relmfu

Video 4 - Office Integration
- Collabration across Office, AX and Visual Studio
- Demo (Budget)
http://www.youtube.com/watch?v=83Rm0Dbgb3g&feature=relmfu

Video 5 - Usability 
- End-User Simplicity
- Recruited people from the industry to test the usability scenarios
- Field Surveys
- Demo AR Customers/SO's (Fact boxes)
- Consolidate Commands into Flexible Activity based Ribbons (Similar Look and feel as Excel, Word)
- Fast tabs
- "Go to Main Table" replaced by hyperlink lookups (cool feature)
http://www.youtube.com/watch?v=CCyUcbTHuc4&feature=relmfu

Video 6 - Enterprise Portal
 - Rich UI
 - Travel Expense Demo
 - Microsoft internal adoption (aka DogFooding)
 - ISV's interested to build on new add'ons for EP
http://www.youtube.com/watch?v=Td2ROxxXzcE&feature=youtube_gdata


Video 7 - Performance
20 x times faster than 2009
- Managed X++
- Leverages Virtualization
- Leverages AppFabric
http://www.youtube.com/watch?v=YRJaMkElvqk


Video 8 - Programmability
-Improvements in X++ Language
-Improvements in Language Performance
-Visual IDE and MorphX IDE
-Attributes
-Marrying C# and X++
-X++ managed language
-AOT in VS.Net
http://www.youtube.com/watch?v=-jUtbBGTt-U


Video 9 - Security
-Improved Administration Experience for setting up Security
-Flexible Authentication (Leverages Claim Based Authentication from Sharepoint)
-Authorization
http://www.youtube.com/watch?v=EYQukrLQF7A&feature=channel_video_title


Video 10 - Simplicity
- Experiences for Developers, Administrators and End Users made simple
- For Developers - Goal to enrich .net and x++ developers experience
- Installation experience for Developer improved (Single Click Experience)
- Simplicity for System Administrators
- Good Feedback from Partner and Customer Channel
http://www.youtube.com/watch?v=-0C6t_vFyX0


Video 11 - Processes and Workflow
-Graphical workflow Editor for Business Users and Application Developers
-Leverages Wofklow Foundation of .Net 4.0
-Flexible Work Item Queues
-60 Workflow Types out of the box
-Sub-Workflows
http://www.youtube.com/watch?v=XQK1sZGkgvg


Video 12 - Organizational Model
-Model for External and Internal Reporting
-Policy Frameworks
-Reporting
http://www.youtube.com/watch?v=EteQAKqwnTU

Tuesday, April 3, 2012

Step by Step Guide How to Install Dynamics AX 2012 - Part 1

How to Install and Configure Dynamics AX 2012 ComponentsOver the past few weeks, I was involved in installing and configuring Dynamics AX 2012 Components on couple of machines running Server 2008 and Windows 7 Enterprise O/S.

Thought I will share my experience here in a series of posts covering  installation of all major components of AX 2012 - Database, AOS, Client, EP Components, Sharepoint 2010, Reporting Services and Business Intelligence.

Overall Installation Experience/Highlights: (Good)

a. I can say compared to my previous experiences with installation of Dynamics AX 4.0 and 2009, Dynamics AX2012 is less error-prone and satisfactory even though, the number of Pre-Requisites to be installed is quite a significant one in 2012

b. Validate Pre-Requisite Tool is quite handy which helps one to prepare for installation so that one is not taken by surprise when he/she performs the actual installation of components

c. Summary Report which comes up at the end is quite cool and user-friendly.

Considerations:

a. Requires more computing power in terms of RAM (As per System Requirements Guide it says 4 GB is the minimum). And from my personal experience, I have seen that AOS service (AX32serv.exe at it's peak, especially when you start the service and bring up the AX Client first time, it goes up close to 1 GB).

b. I also tried the fully loaded image from PartnerSource  on a machine which had overall 6GB RAM, allocated 4GB to the VM, but still it was crawling. It took me ages to bring up the AOS Service.

c. Since now the AOD is no longer file based and the models reside in SQL Server, you also need to plan ahead for the disk capacity for your SQL boxes. Standard AX database (Application) along with the model database (AOD) bulks up to 3 GB approx and if you want Contoso DB (Demo Data loaded) you should free up atleast 10 GB.

Ok, Now I will jump start the installation process starting with installation of Database, AOS and Client Components. I had captured the screenshots along the way as this will help me and my peers when we setup DEV, Test, Pre-Prod and Prod Environments.

Initial Setup Screen














Pre-Requisite Validation Utility

Note - Here, I'm just installing the components which are checked below: Database, AOS, Client Components, Debugger (My favorite ;-) and Management Utilities

Tip - I would suggest from my personal experience of installing AX, even though Single-Computer Installation sounds easy and quick but we don't get the proper control here, so I prefer Custom Installation and choose my components, easy to troubleshoot and learn as we go



















This screen shows you the list of validation errors which means you need to install the base pre-requisites software before you proceed.

The first error shown below is about the SQL Server Full Text Search is not installed or the service is not running
















Launch SQL Server Setup and Install Full-Text Search component











Next, comes the Report Viewer Control. You need to download it from here http://www.microsoft.com/download/en/details.aspx?id=6442

  











Some other pre-requisites which needs to be configured and installed are as follows:



Please Note, as per the Operating System whether it's Server 2008 or Win 7, it might ask you for some other pre-requisites as well, so I would suggest you run the pre-requisite validator and please don't go by the assumption that the above  links are the ONLY pre-requisites required.

.







Once the Pre-Requisites are installed successfully, you can kick start the Installation




















Tip - You can change the location here



































Select the Components you want to install, based on your implementation topology you might want to install different components on different boxes. As I'm setting up a Sandbox at the moment, I just installed everything in one box

Didn't thought of much experimenting with Themes so left it as it is.





















You can change the database names at this step below if you want to.

















Key in the ports for AOS and Services
















Note - For demo or training purposes, it's ok to go with network service but when you are setting up for pre-prod or production environments, you should choose a proper service account for AOS Account

This is kinda cool as you have the option below to choose the installation type as Developer, Administrator or Business and accordingly it will bring up the workspace for you after the install. At this moment, I'm wearing the administrator hat :-)

All set and ready to go...























You can take a break now ;-) and come back as this step took me good 15-20 mins time!



I love this :-)
















And this too.. The Summary Report comes up quite good (This is a new installation feature in 2012 which is a brief summary of the components installed )














Next, you can go ahead with the Compile Checklist.. One other small nice feature which I like is "Processing..." pop up below, it's quite interactive unlike previous versions, where you don't know what's happening and everything looks stuck

  






Next, I will be posting my experience on other big components of AX2012 starting with Configuring EP, Sharepoint 2010, SSRS and Business Intelligence. Keep looking at this space!! Till then Happy Dax'ing...

Monday, November 7, 2011

Form templates in Dynamics AX 2012

A primary focus in Dynamics AX 2012 was to increase a developer's productivity by automating common tasks. As part of this initiative, a new feature was introduced in Dynamics AX 2012 in the AOT. This is the creation of new forms using form templates.

If you right click on the form node, you can see an extra option there - New Form from template
As seen in the image above, you have an option to create seven different form based on the pre-defined templates, these are
  • ListPage
  • DetailsFormMaster
  • DetailsFormTransaction
  • SimpleListDetails
  • SimpleList
  • TableOfContents
  • Dialog
  • DropDialog
Let us look at these in more details.

ListPage - A list page is a form that displays a list of data related to a particular entity or business object. A list page provides provisions for displaying data and taking actions on this data. Every module has at least a couple of list pages. List pages are further classified as primary and secondary list pages. A secondary list page will only display a subset of data from the primary list page. Example, CustTableListPage, VendTableListPage, ProjProjectsListPage. Best practice is to have ListPage as a suffix in the name of the form for all list pages.

DetailsFormMaster - This template is used for forms which displays data for stand-alone entities or business objects. Example, Customers, Vendors, Projects etc. If you look at the forms for these, i.e., CustTable, VendTable, ProjTable, their style property will be set to DetailsFormMaster.

DetailsFormTransaction - This template is used for forms which displays data for entities which have child records associated with it. In other words, if the data being displayed is header-lines type in nature, use this template. Example, Sales orders, Purchase orders etc. If you look at the style property of SalesTable, VendTable, their properties will be set to DetailsFormTransaction.

SimpleListDetails - This template is used to display primary fields in a list and detailed data in a tab page. This style is useful to view all records in a form and selecting a particular record will bring up their details. Example, MainAccount

SimpleList - This template is a very basic form which displays data in a grid. No extra or fancy detail is displayed. This style is best suited for forms where data being shown is not very detailed in nature or has limited fields. Example, AifAction.

TableOfContents - This template is the new style which should be adopted for all parameter forms in Dynamics AX 2012. Take a look at any parameters form and its style property will be set to TableOfContents. This style sets all the tabs as a hot link in the left hand side navigation pane. Clicking on the link will bring up the controls on that tab page. This style is a very neat and appealing UI design which is surely welcome.

Dialog - This template is used on forms which shows static data or are intended to capture some user input for further actions. These forms are mostly modal in nature and should be dismissed before any further actions can be taken.

DropDialog - This template is used for forms that are used to gather quick user inputs to perform an action. Drop dialog forms are generally attached to an action pane button. They appear to be dropping from the menu button when clicked.

Whenever going for a new form development, always ensure that you use the template to create a new form. The template almost does 40% of your design work for you. All you have to do is add the data sources and fields and add business logic.

Microsoft has taken a lot of customer feedback and invested a lot in the UI design. There are reasons why the buttons and navigations are laid out like they are. If you are deviating from the recommended best practices, not only are you introducing best practice deviations, you may be complicating the design and navigation for your users.

In case, you already have designed forms without using the pre defined templates, you can run the form style best practices checker from add-ins. This will list out all deviations your form has and you can fix them by clicking a button.

Also, you may see some best practice warnings when designing forms using the templates. These can be safely ignored. Examples of such best practice warnings are
  • An Action Pane should not be present on a form that is not a list page or other content page.
  • Expected: @SYS316708 (Attachments) | Actual: @SYS114630 (Attachments)
Even though, these are listed as best practice warnings, there are numerous samples in standard AX forms where these deviations have been made.

For more details on the new Dynamics AX 2012 forms and their design guidelines, check the Form User Experience Guidelines page on MSDN.

I hope this post was useful and you will start using the new templates in your development.