Tuesday, April 19, 2011

Count Records in Query in AX 2009

Following code illustrates how we can use SysQuery::countTotal() method to get the number of records in Query.

static void Query_cntRecords(Args _args)
{
    Query                query = new Query();
    QueryRun             queryRun;
    QueryBuildDataSource qbd;
    ;
  
    qbd = query.addDataSource(tablenum(CustTable));
    queryRun = new QueryRun(query);
  
    info(strfmt("Total Records in Query %1",SysQuery::countTotal(queryRun)));
  
}

String to Validate only Numbers [Regular Expression is AX 2009]


Following is an Example of Regular Expressions :

static void TextBuffer_regularExpression(Args _args)
{
    TextBuffer txt = new TextBuffer();
    str msg = "98797897";
    ;


    txt.setText(msg);
    txt.regularExpressions(true);   // activate regular expr in search


     // Regular expression to validate only digits
     if (txt.find("^[0-9]+$"))
    {
        info("string contains only numbers");
    }

}

What's new in the workflow system [AX 2012]

 The following features have been added to the workflow functionality in Microsoft Dynamics AX 2012.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Simplified installation
Workflow server components no longer need to be installed on a web server running Internet Information Services (IIS). Workflow server components are now automatically installed when you install the Microsoft Dynamics AX Application Object Server (AOS).
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Upgrade information
Workflows created in Microsoft Dynamics AX 2009 will not be upgraded. Before you upgrade to Microsoft Dynamics AX 2012, we recommend that you process all business documents that have been submitted for processing, or cancel the workflows that are currently in progress.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Flow-control elements
Several new elements have been added to help you design workflows. These elements enable you to design workflows that have alternate branches or branches that run concurrently. These elements include:
  • Conditional decision — A point at which a workflow divides into two branches. The system will decide which branch to use by evaluating the submitted document to determine whether it meets a specified condition.
  • Manual decision — A point at which a workflow divides into two branches. A user must take an action, and the action taken will determine which branch is used to process the submitted document.
  • Parallel activity — A workflow element that includes two or more branches that run at the same time.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Automated task
You can now add an automated task to your workflows. An automated task executes business logic and requires no human interaction. For example, an automated task can perform a credit check, run a report, or update a record.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Workflow editor
The workflow editor is a graphical interface that enables you to model Microsoft Dynamics AX 2012 workflows by arranging workflow elements on a canvas—similarly to how you would graphically model a business process using Microsoft Visio. You can add, delete, and reposition workflow elements that represent the tasks and approvals that make up the workflow. You can also add flow-control elements, such as manual and conditional decisions, automated tasks, parallel activities, and subworkflows so that you can create complex workflows that precisely model the business processes you want to automate.
For each element in the workflow, you set properties that determine such things as the assignment of a task, the time allowed for completing a task, an escalation path in case the time limit for the task is exceeded, who will be notified about specific events related to the task, and any automatic actions that will be taken for the task.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Line-item workflows
You can now implement workflows for the line items on a document. For example, you may want to configure a workflow for timesheets where each line item on the timesheet is approved by a specific project manager.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Work item queue
In Microsoft Dynamics AX 2009, you could assign a workflow task to a user, role, or organizational hierarchy. In Microsoft Dynamics AX 2012, you can now assign a workflow task to a work item queue, as well. A work item queue is a collection of documents that require processing. A queue must have users assigned to it. Those users will be responsible for monitoring the queue and processing the documents in it.
You can determine which users you want assigned to the queue. Any user assigned to the queue can complete any of the tasks in the queue.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Workflows and your organizational structure
In Microsoft Dynamics AX 2009, each workflow was company-specific. In Microsoft Dynamics AX 2012, a workflow can be used in the following ways:
  • A workflow can be used across all organizations. (These types of workflows can be used only with documents that contain organization-wide data.)
  • A workflow can be used for a specific organization, such as a particular legal entity.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Notifications
The following changes have been made to improve the workflow notification system.
  • Workflow-specific notifications — Email templates are used to send workflow notifications. You can now create and use a specific email template for each workflow. This enables you to customize the message so that is appropriate for each workflow.
  • Aggregated notifications — With Microsoft Dynamics AX 2012, you can implement workflows for the line items on a document. Because line-item workflows may generate more email notifications, Microsoft Dynamics AX 2012 now enables workflow participants to aggregate their notifications for line items into a single email message.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Workflow performance analysis reports
A workflow online analytical processing (OLAP) cube is included with Microsoft Dynamics AX 2012. Using this cube, you can generate a report that shows how a workflow performs so that you can identify bottlenecks in processes. You also can determine if the workflow is adding efficiency to your business processes, and provide a means of comparing the automated workflow to the manual processes it replaced. The analysis focuses on showing how much work was done using the workflow and how much time it took to perform the business tasks that make up the workflow. By using these reports, you can modify your workflows and optimize their performance.
Description: http://i.msdn.microsoft.com/Global/Images/clear.gif  Workflow history
You can view the workflow history and the status of an active or completed workflow and its elements that includes data about new workflow features, such as advanced flow-controls, automated tasks, line-item workflows, and work item queues. You can view this data either in the Microsoft Dynamics AX client or the Enterprise Portal for Microsoft Dynamics AX.

AX 2012 Major Functionalities

Following are the New Features in AX 2012 :



  • Microsoft Dynamics AX 2012 uses Microsoft SQL Server as the default data management system, for more uniform embedded business intelligence functionality.
  • Bi-directional integration with Microsoft Office 2010, and Enterprise Search functionality through connection with Microsoft SharePoint 2010 Business Connectivity Services.
  • Integration with Microsoft Lync 2010 collaboration and communication services.
  • Overall design streamlining, including the simplification of processes, and access to RoleTailored business intelligence data.
  • Support for currencies, time zones, languages, and regional banking, reporting and legislative compliance for business systems in 38 countries worldwide.

AX 2012 Training & Exams



Microsoft Learning: What’s new Training”
The objective of the Microsoft Dynamics AX 2012 What’s New series is to provide a classroom (ILT) and eLearning (EL) experience that highlights the new capabilities in Microsoft Dynamics AX 2012.
The What’s new training will be available on Microsoft Learning, Partner Source and Customer Source. Links will be added to the courses as they become available.
Course
Number
Title
Format
ILT Duration
Orderable Date
80163
What's New in Microsoft Dynamics AX 2012 for Supply Chain Management and Manufacturing
TM | ILT | EL
1 day
21st April 2011
80164
What's New - Application in Microsoft Dynamics AX 2012 for Finance, PA, Case Mgmt., HRM and Public Sector
TM | ILT | EL
1 day
21st April 2011
80165
What's New in Microsoft Dynamics AX 2012 for Implementation
TM | ILT | EL
1 day
21st April 2011
80299
What's New in Microsoft Dynamics AX 2012 for Development
TM | ILT | EL
2 days
21st April 2011

Microsoft Learning: Microsoft Dynamics AX 2012 Official Courses
The objective of the official course material is to provide training content that addresses the components and capabilities of Microsoft Dynamics AX 2012. Microsoft Official Courses (MOC) provides job-relevant, accurate Microsoft instructions. Each classroom training course (ILT) lasts one to four days and includes the planning, design, implementation, management and support phases of the application lifecycle. Each course helps you gain proficiency through hands-on labs, simulations, and real world application of skills. These courses will also be provided in eLearning (EL) format where specified.
The courses will be available on Microsoft Learning and on Partner Source (requires a service plan or Training pack)
Links will be added to the courses as they become available.
Course Number
Title
Audience
Format
Duration
Release Date
80303
Development I in Microsoft Dynamics AX 2012
Application
Developer
ILT, EL
2 days
Aug-11
80304
Development II in Microsoft Dynamics AX 2012
Application
Developer
ILT, EL
2 days
Aug-11
80219
Financials I in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
3 days
Aug-11
80220
Financials II in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
3 days
Aug-11
80302
Fixed Assets in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
2 days
Aug-11
80305
Supply Chain Foundation in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
2 days
Aug-11
80306
Distribution and Trade in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
3 days
Aug-11
80221
Installation and Configuration for Microsoft Dynamics AX 2012
Technology Consultant
ILT, EL
2 days
Aug-11
80312
Development III in Microsoft Dynamics AX 2012
Developer
ILT
3 days
Sep-11
80309
Process Industries Manufacturing in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
2 days
Sep-11
80310
Lean Manufacturing in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
4 days
Sep-11
80338
Public Sector - Financials in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
2 days
Sep-11
80339
Bill of Materials in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
2 days
Sep-11
80316
Project Essentials in Microsoft Dynamics AX 2012
Application Consultant
ILT
2 days
Sep-11
80317
Project Advanced in Microsoft Dynamics AX 2012
Application Consultant
ILT
3 days
Sep-11
80308
Procurement in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
2 days
Sep-11
80311
Resource Management in Microsoft Dynamics AX 2012
Application Consultant
ILT, EL
3 days
Sep-11
80314
Discrete Manufacturing Basics in Microsoft Dynamics AX 2012
Application Consultant
ILT
2 days
Sep-11
80315
Discrete Manufacturing Advanced in Microsoft Dynamics AX 2012
Application Consultant
ILT
2 days
Sep-11
80318
Reporting in Microsoft Dynamics AX 2012
Application Consultant
ILT
2 days
Sep-11
80313
Development IV in Microsoft Dynamics AX 2012
Developer
ILT
4 Days
Q4 CY 2011
TBD
Professional Services Development in Microsoft Dynamics AX 2012
Developer
ILT, EL
1 day
TBD
Microsoft Dynamics AX 2012 Certification Exams
The objective of the Microsoft certifications is to bring valuable, measurable, rewards to IT professionals, their managers, and the organizations that employ them. These certifications are designed to provide the recognition needed to help professionals excel in their career and provide a validation of skills.
Microsoft Certification Exams can be found on Microsoft Learning or www.prometric.com/default.htm
Title
Audience
Planned Availability
Finance in Microsoft Dynamics AX 2012
Application Consultant
September 2011
Trade and Logistics in Microsoft Dynamics AX 2012
Application Consultant
September 2011
Installation and Configuration in Microsoft Dynamics AX 2012
Technology Consultant
September 2011
Development in Microsoft Dynamics AX 2012
Developer
September 2011
Lean Manufacturing in in Microsoft Dynamics AX 2012
Application Consultant
TBD
Morph X Solution Development in Microsoft Dynamics AX 2012
Developer
TBD
Process Industries in Microsoft Dynamics AX 2012
Application Consultant
TBD
Production in Microsoft Dynamics AX 2012
Application Consultant
TBD
Professional Services in Microsoft Dynamics AX 2012
Application Consultant
TBD
Project Management and Accounting in Microsoft Dynamics AX 2012
Application Consultant
TBD
Public Sector in Microsoft Dynamics AX 2012
Application Consultant
TBD
Retail Management in Microsoft Dynamics AX 2012
Application Consultant
TBD

Create a Sales Order in AX 2009 using X++


Following is the Example of Creating a SalesOrder using X++ :

static void createSalesTable(Agrs args)
{
SalesTable salesTable;
NumberSeq NumberSeq;
;
NumberSeq =NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequence);
salesTable.SalesId = NumberSeq.num();
salesTable.initValue();
//you can also pass your account number from query
salesTable.CustAccount = "1101";
salesTable.initFromCustTable();
salesTable.insert();
info("Sales Order has been Created Sucessfully");
}

Post a Ledger Journal in AX 2009 using X++

Following is the code for Posting a Ledger Journal using X++ :


static void ExampleLedgerJournal(Args _args)
{
LedgerJournalName LedgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberseq;
LedgerJournalNameId LedgerJournalNameId = 'GenJrn';
BankAccountID BankAccountID = 'EUR OPER';
ledgerAccount offsetAccount = '601500';
amountCur amountCur = 102;
;
ttsbegin;
// Find a ledgerJournalName record
select firstonly LedgerJournalName
where LedgerJournalName.JournalName ==LedgerJournalNameId;
//Created the ledgerJournalTable
ledgerJournalTable.JournalName =LedgerJournalName.JournalName;
ledgerJournalTable.initFromLedgerJournalName();
ledgerJournalTable.Name = 'Hotel';
ledgerJournalTable.insert();
numberseq =NumberSeq::newGetVoucherFromCode(ledgerJournalName.VoucherSeries);
ledgerJournalTrans.Voucher = numberseq.voucher();
//Generate the transaction line
ledgerJournalTrans.JournalNum =ledgerJournalTable.JournalNum;
ledgerJournalTrans.CurrencyCode = 'EUR';
ledgerJournalTrans.ExchRate =Currency::exchRate(ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = BankAccountID;
ledgerJournalTrans.AccountType =LedgerJournalACType::Bank;
ledgerJournalTrans.AmountCurCredit = amountCur;
//Pass the Date . You can also use str2Date('08/08/2008') if period is not defined.
ledgerJournalTrans.TransDate = today();
ledgerJournalTrans.Txt = 'Room Stay';
ledgerJournalTrans.OffsetAccount = offsetAccount;
ledgerJournalTrans.OffsetAccountType =LedgerJournalACType::Ledger;
ledgerJournalTrans.insert();
info(strfmt('Journal Id:%1',ledgerJournalTable.JournalNum));
//Post the Journal
ledgerJournalCheckPost= ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::Yes);
ledgerJournalCheckPost.run();
ttscommit;
}