Showing posts from November, 2012

The MorphX Tools - Project Designer

How to Create a Project in AXaptaFor a fully customizable overview of the elements, you can use projects. In a project, elements can be grouped and structured according to the developer’s preference. The Project Designer is a powerful alternative to the AOT because you can collect all the elements needed for a feature in one project.Creating a New ProjectYou open the Project Designer by clicking the Project button on the toolbar. Figure 1 shows the Project Designer and its Private and Shared projects.

Figure 1. Project Designer, showing available private and shared projects

Except for its structure, the Project Designer behaves exactly like the AOT. Every element in a project is also present in the AOT.
When you create a new project, you must decide whether it should be private or shared among all developers. You can’t set access requirements on shared projects. You can make a shared project private (and a private project shared) by dragging it from the shared category into the private c…

How to go to the object from Infolog

How to go to the object from InfologWhen we print a transaction id through infolog Usually, it is more useful if the user can go directly to the object from an Infolog line.

For example, we need to see all the BOM without any active version. By the way, this is a good example, too, for what we cannot do by means of Advanced Filter but quickly by coding a short job.

static void SIBOMwithNoActiveVersion(Args _args) { BOMTable bomTable; BOMVersion bomVersion; int nmbr, i; boolean printOnly = false; ; SetPrefix('BOMs without any active version'); Nmbr = 0; while select bomTable notexists join bomVersion where bomVersion.Active == NoYes::Yes && bomVersion.BOMId == bomTable.BOMId { nmbr++; info(strfmt("%1 %2, %3, %4, %5, %6, %7", nmbr, bomTable.BOMId, bomTable.Na…

Opening the table from x++ code

Opening the table from x++ codeThis code helps you to open the any Table from X++ code. Here is an example for SalesTable, just copy and paste this into a job you will get the table.

static void TableBrowser(Args _args)
SysTableBrowser sysTableBrowser = new SysTableBrowser();
//Browse the SalesTable table ));

How to run Client Batches on AX 2009

How to run Client Batches on AX 2009In AX 2009 the batch engine has been changed to run as a service.
The batch services do only process server batches they don't process client batches aynmore.
There might still be some situations where you would like to run client batches.
The following description explains how to do this.
Create a new batch group 'Client' which is used for client batches later.
(Administration -> Setup -> Batch groups) Add this batch group to an AOS acting as batch server.
(Administration -> Setup -> Server configuration)
This is needed to change the status from 'Waiting' to 'Ready' on the batch tasks and to 'Execute' on the batch jobs.
The batch server will not process any client batches.
Start the legacy batch client
(Basic -> Periodic -> Batch -> Processing) Select the new created batch group 'Client' and press 'OK'The client batch server will now process all client batches of the 'Client'…

Designate a batch server

Designate a batch server A batch server is an Application Object Server (AOS) instance that processes batch jobs. Batch jobs are used to run tasks, such as printing reports or posting journals, at a specified time and probably on a different computer.
The first AOS to be set up is automatically designated as a batch server. Use multiple batch servers to increase throughput and reduce the amount of time it takes to run batches.

When you set up a batch server, you can specify the times that it is available for batch processing. We recommend excluding a server from batch processing when it is busy with regular transaction processing. For example, you may have servers in different time zones. You can set server schedules so that each AOS is available for user traffic during the day and for batch traffic overnight.

For more information about batches, 
see the Applications and Business Processes Help, 
available from the Microsoft Dynamics AX Help menu. 

1. Click Administration > Setup

How to update vendor addresses in Dynamics AX

How to update vendor addresses in Dynamics AX 2009 Here is trick of X++ by which we can update the address for a vendor in Dynamics ax 2009,  below job is the possible answer and may helps.

static void UpdateVendAddressType(Args _args)
VendTable          vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable     dirPartyTab;
Address              addTab;
while select vendTab join dirPartyTab join forupdate addTab
                                                          where vendTab.PartyId        == dirPartyTab.PartyId
                                                             && addTab.AddrTableId == dirPartyTab.TableId
                                                            && addTab.AddrRecId     == dirPartyTab.RecId
      if(addTab.Name == ‘Birincil Adres’)
        addTab.type = AddressType::Payment;

- Harry

Create Alert using X++ codes

Create Alert using X++ codes
Sometimes Infolog message is not sufficient enough for prompting information to users. It is possible to create alert message using code as an alternative. It is fairly simple to create alert message manually by just inserting a new record in EventTable where all the alert messages are stored. Below is a code snippet for creating alert using code in AX 2009.
Try following code......

staticvoidCreateAlertUsingCode(Args _args)
EventInbox          inbox;
inbox.ShowPopup     = NoYes::Yes;
inbox.Subject       = "This is the Alert subject";
inbox.Message       = "This is the Alert message";
inbox.AlertedFor    = "This alert is just information no links are available";
inbox.SendEmail     = false;
inbox.UserId        = curuserid();
inbox.TypeId        = classnum(EventType);
inbox.AlertTableId  = tablenum(Address);
inbox.AlertFieldId  = fieldnum(Address, Name);
inbox.TypeTrigger   = EventTypeTrigger::FieldChanged;

SysQueryRangeUtil class -Use method name as query criteria(Reports)

SysQueryRangeUtil class - use method name as query criteriaThis is a cool new feature in AX 2009 - you can now use a method name instead of literal value in query criteria!
For example, if you run a report every month, previously you need to change the date criteria in each month you running the report  (ie.“01/06/2010..30/06/2010”,  “01/07/2010..31/07/2010”, etc).
Now you only need to enter(monthRange(0, 0))which will automatic return the correct first day and last day of the month.
For Example: - 

You can also refer to theSysQueryRangeUtilclass – there are a lot of useful methods such as dateRange(), currentEmployeeId(), etc. It’s also possible to create new method on this class for special purpose. But do this with caution.

- Harry

Finding all data sources in a form through Job

Finding all data sources in a form through code Hi , Here is small trick to find the datasource in form. Open job node , and a new job and copy paste following code over there,.....
static void AllDataSourcesInForm(Args _args)
    Args args = new Args();
    FormRun fr;
    FormBuildDataSource formBuildDataSource;
    counter i;
    ;"CustTable");   // its your FORM name
    fr = ClassFactory.formRunClass(args);
    for(i=1 ; i<=fr.form().dataSourceCount();i++)
        formBuildDataSource = fr.form().dataSource(i);
        info(new DictTable(formBuildDataSource.table()).name());

When you run this job you get all data source which is used in CustTable Form

- Harry

Differences among reread(), refresh(),research()

Differences among reread(), refresh(),research()When working with Forms, commonly after opened the form we need to do some operations with existing data. In few cases we need to interact with data base again and again in order to do. For that we will use these methods. But some times its create confuse what exactly use of these methods, when should we call these methods and why, here is brief info these methods...

refresh() : this method will refresh the data in the data source cache. But it will not interact with the data base to fetch the new/updated record values. What ever values have fetched in the previous query will store in data source cache, this method will just refresh the data source cache only.

reread(): this method will interact with the data base and runs the query against the data base in order to fetch the new/updated record values. But this will not show the updated values in the form until calling the refresh method. that means it will update the data source form cach…

How to get the current database name in axapta

How to get the current database name in axaptaHere is a small trick to know the name of current data base in axapta. Axapta supports a class called SysSqlSystemInfo by using this class we can get the current database name... To do this just create a new job and write following code or you can copy paste from here also.

static void sqlSysName(Args _args)

- Harry