Tuesday, January 31, 2012

Validate Table from X++

Hi,
   From the below code you can easily validate a table field using X++ code.


static server boolean validateTable(common _common)
{
boolean ret = true;
SysDictTable    dictTable;
int fldCnt, i;
fieldId fid;
;


dictTable = new SysDictTable(_common.TableId);
fldcnt = dictTable.fieldCnt();
for(i = 1; i <= fldcnt; i++)
{
fid = dictTable.fieldCnt2Id(i);
ret = ret && _common.validateField(fid);
}
info(strfmt('Validation Result :%1',ret));
return ret;
}


Deploy SSRS Reports using Code in AX 2012


Following code can be used to deploy SSRS reports in Ax 2012.
However make sure that this code runs from the client, and not as CIL (otherwise you will get run time errors)
I can run this below code as a job and works fine.
Plz Note : This code will only work in AX 2012 as in AX 2009/4.0/3.0 there were no SSRSReport Classes.

static void deploySSRSReportDemo(Args _s)
{
SSRSReportManager mgr=new SSRSReportManager();
SSRSReportConceptNode node=new SSRSReportConceptNode();
;
node=TreeNode::findNode(@"\\SSRS Reports\Reports\SalesInvoice");
mgr.deploymentStart();
mgr.deployReport(node);
mgr.deploymentEnd();
}

Enjoy DAX!!!

Sunday, January 29, 2012

Dynamics AX Technical Consultant Interview Questions Series II

Hi,
   Hope you have enjoyed my Previous post for Dynamics AX Technical Interview Questions Series I
Please Find some more Technical Questions below :


  1. What’s new in Dynamics AX 2012
  2. OOPs concepts
  3. Definition of AOT elements
  4. Document Management and Print Management
  5. Visual Form & Report designer
  6. Unit test framework
  7. Reverse Engineering tool
  8. Version Control System in AX 2009
  9. Layers & their usage.
  10. Web Services concept
  11. AIF in Dynamics AX 2009
  12. AX 2009 Workflow configuration
  13. Dynamics AX security hierarchy
  14. AOS Load balancer concept/Clustering
  15. Differences Between :-
    1. AX 4.0 & AX 2009
    2. MorphX & Intellimorph
    3. RunBase & RunBaseBatch
    4. element & this
    5. COM & .NET Business Connector
    6. Concurrent user & Named user
    7. Primary key & Foreign key
    8. Construct & New methods
    9. VSS & TFS
    10. Table & View in AOT
    11. Auto design & Generated design in reports
    12. Business connector & External Connector
    13. Refresh(),reread(),research() & executeQuery()
    14. formDataSource.queryRun().query() & formDataSource.query()
    15. Normal, field fixed & related field fixed relations




Enjoy DAX !!!

Thursday, January 26, 2012

How to Create New Role Center in AX 2009


Create new role center in Dynamics Ax 2009

Compiled from Dynamics Ax Developer help for quick reference.
  1. Open Dynamics Ax enterprise portal (default installation is http://servername/sites/DynamcisAx).
  2. Click on Site Action > Create . Choose Web part page (as most Ax role center using this). Complete the page creation.
  3. Open Ax client > AOT > Web > Web menu item > URLs > New URL.
  4. Specify URL Properties by clicking on the elipsis button. Browse Enterprise portal folder and choose the .aspx page created in the step 2.
    If got error go to here.
  5. Set home page property to YES. (If not the page will not be available to be chosen as user profile role center page).
  6. Right click > Import. This will import the page to AOT under web > web files > page definitions.
  7. Locate the new page definition on step 6. Set the page title properties.
  8. Go to Admin > Setup > User profile. Create a new record. Choose the role center column from drop down.
  9. Click view role center button to test.
Enjoy DAX!!!

Sunday, January 22, 2012

Purchase Order using X++

Hi,
In this post we will learn the below using X++ :

 1) How to Create Purchase Order
 2) How to Create Purchase Order Line
 3) How to Post Purchase Order



static void PurchaseOrder(Args _args)
{
PurchTable pt;
PurchLine pline;
NumberSeq ns;
PurchID pid;
PurchFormLetter pl;
;
//Create Purchase Order
ns=NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().NumberSequence);
pt.initValue();
pid=ns.num();
pt.PurchId=pid;
pt.OrderAccount="4202";
pt.initFromVendTable();
pt.insert();


//Create Purchase Line
pline.clear();
pline.PurchId=pid;
pline.ItemId="1109";
pline.createLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);
info("Purchase Order Created Sucessfully");


//Post the PO
pl=PurchFormLetter::construct(DocumentStatus::Invoice);
pl.update(PurchTable::find(sid),sid,SystemDateGet(),PurchUpdate::All,AccountOrder::None,false,true);
info("Posted Sucessfully");
}


Enjoy DAX!!!

Sales Order using X++

Hi,
In this post we will learn the below using X++ :

 1) How to Create Sales Order
 2) How to Create Sales Order Line
 3) How to Post Sales Order


Code :
public static void SalesOrderDemo(Args _s)
{
// Create the Sales Order

SalesTable salesTable;
NumberSeq NumberSeq;
SalesId sid;
SalesLine sl;
SalesFormLetter fl;
;
NumberSeq =NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequence);
sid=NumberSeq.num();
salesTable.SalesId = sid;
salesTable.initValue();
salesTable.CustAccount = "1101";
salesTable.initFromCustTable();
salesTable.insert();

//Create the Sales Line with the created Sales Order
sl.SalesId=sid;
sl.ItemId="1109";
sl.CreateLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);

info("Sales Order Created with Line");

//How to Post the Sales Order Invoice


fl=SalesFormLetter::construct(DocumentStatus::Invoice);
fl.update(SalesTable::find(sid));
info("Sales Order Posted");

}


Enjoy DAX!!!

Friday, January 20, 2012

Common Prefixes in AX 2009

Hi DAXers,

Please see the common prefixes used in AX 2009 :


Prefix Description
Ax Dynamics AX Typed Data Source
Axd Dynamics AX business Document
BOM Bill of Material
COS Cost Accounting
Cust Customer
HRM Human Resources management
Invent Inventory Management
JMG Shop floor management
KM Knowledge Management
Ledger General Ledger
PBA Product Builder
Prod Production
Proj Project
Purch Purchase
Req Requirements
Sales Sales
SMA Service Management
SMM Sales and Marketting Management
Sys Application Framework and development tools
Tax Tax Engine
Vend Vendor
Web Web Framework
WMS Warehouse Management



Tip When creating new elements, make sure to follow the recommended naming conventions.
Any future development and maintenance will be much easier.