Posts

Showing posts from July, 2012

How to split a Form in two window

Image
hi Friends,
WE a going to create a new form and want to show this form in two interrelated windows, like the following form

on the basis of the header the line level information will update,
so for get this type of design in your form you have to write three methods in from design.
1.
int mouseDown(int x, int y, int button, boolean ctrl, boolean shift)
{
    int ret;
    ret = super(x, y, button, ctrl, shift);
    return _formSplitterVertical.mouseDown(x, y, button, ctrl, shift);
}

2.
int mouseMove(int x, int y, int button, boolean ctrl, boolean shift)
{
    int ret;
    ret = super(x, y, button, ctrl, shift);
    return _formSplitterVertical.mouseMove(x,y,button,ctrl,shift);
}

3.
int mouseUp(int x, int y, int button, boolean ctrl, boolean shift)
{
    int ret;
    ret = super(x, y, button, ctrl, shift);
    return _formSplitterVertical.mouseUp(x, y, button, ctrl, shift);
}

after adding these three methods in your form design it will spilt  into two windows, now write your code for vali…

Top 5 AIF Development Tips and Tricks

Image
Top 5 AIF Development Tips and Tricks
1. Enable the debugger
You will notice, if you put a breakpoint into your document class, that when you run the associated action, the breakpoint will get ignored – leaving you in the dark. This is because the action is called using a ‘runas’ function call  to change the user executing the code.
To workaround this replace the runas method calls with direct calls in\Classes\AifOutboundProcessingService\ and \Classes\AifInboundProcessingService, eg:
1/*2runas(message.sourceEndpointAxUserId(),3classnum(AifInboundProcessingService),4staticmethodstr(AifInboundProcessingService, processAsUser),5[message.pack(), messageId]);6*/7AifInboundProcessingService::processAsUser([message.pack(), messageId]);
2. Run jobs instead of waiting for batch processing
The usual way for the AIF to run is using the batch processing framework, where you setup an interval for the inbound and outbound processing  to run.  This minute or so can feel like an age when you are in t…

How to fetch Values from WorkFlow Tables

How to fetch Values from WorkFlow TablesHi friends,    I am facing a problem since many days and now i got the logic to fetch values from a workflow table, but still it’s for only PO and PR and i am working on the GL transaction also, here is the Code, Use copy and paste it in a job and run.

static void theaxapta_WorkflowHisory() {     WorkflowTrackingTable           workflowTrackingTable;     WorkflowStepTable               workflowstepTable;     WorkflowTrackingStatusTable     workflowTrackingStatusTable;     WorkflowTrackingCommentTable    workflowTrackingCommentTable;
    utcdatetime     dt[];     string100     Comment;     int i;     ;     i = 1;    select workflowtrackingtable join workflowsteptable     where workflowsteptable.StepId == workflowtrackingtable.StepId     &&    workflowtrackingtable.ContextRecId == PurchTable::find('NBH1112_PO000025').RecId;
   while select workflowtrackingtable             where  workflowtrackingtable.ContextRecId == PurchTable::find('NBH1112…

Add a button to go to Main Transaction

Add a button to go to Main TransactionHi guys,

The following code for adding a button on your forms to go to the main transaction form/table, to do this type of magic you have to add a button on you form and copy paste the following code in the click method of that button.

void clicked()
{
    Common buffer;
    selectableDataArea company = curExt();
    Args args = new Args();
    SysDictTable dictTable;
    FormRun formRun;
    WorkflowTrackingStatusTable trackingStatus;
    ;
    trackingStatus = WorkflowTrackingStatusTable::findByCorrelation(WorkflowTrackingStatusTable.CorrelationId);
    if (trackingStatus.RecId)
    {
        changecompany(trackingStatus.ContextCompanyId)
        {
            dictTable = new SysDictTable(trackingStatus.ContextTableId);
            buffer = dictTable.makeRecord();
            select buffer where buffer.RecId == trackingStatus.ContextRecId;
            if (! buffer)
            {
                 info('You cannot go to the origin of the workflow instance. The rec…

Reporting Framework in AX 2012

Hi friends,     Today i want to share reporting concepts in AX 2012 with you guys.....
We will start with understanding basic concepts in Reporting Framework to examples.
Reporting Framework Terminologies,
As you all know, the reports in AX 2012 have moved to SSRS reporting, so MS has introduced a robust reporting framework wrapping over the basic SSRS reporting functionality. There are many terms used in reporting framework in AX that I will try and explain here: ·        Report Definition Language: RDL is an XML application primarily used with Microsoft SQL Server Reporting Services. RDL is usually written using Visual Studio. AX has Report Definition Language Contract classes that can generate and build the RDL for an AX SSRS report. This contract provides a weakly typed representation of parameters. It contains methods that can be used to get or set values. It also contains a map of parameter names and the SrsReportParameter class. The base class is SrsReportRdlDataContract.
·        Re…

Microsoft Dynamics AX Development Best Practice

Microsoft Dynamics AX Development Best Practices
A  resource for AX Developers. "Microsoft Dynamics AX Development Best Practices White Paper". Apart from this check out MSDN for some very good knowledge on the following:
Best Practices for Microsoft Dynamics AX Development
Designing a Microsoft Dynamics AX Application
-Harry

How to enable debugging on Server

How to enable debugging on ServerIn most of the cases, our X++ classes have to be executing within the server (AOS). In a default deployment, we're not able to debug server code.
To have this Dynamics AX feature, we must enable it in ‘Microsoft Dynamics AX Server Configuration Utility’ tool (within 'Administrative Tools' menu).
You may need to use the Manage button to Create a new Configuration. Then, on the first tab, Application Object Server, make sure that the check box option "Enable breakpoints to debug X++ code running on this server" is checked.
There is a direct registry key to do it, too. (but this way may be not supported):
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dynamics Server\4.0\01\ Original (installed configuration)]

"xppdebug"="1"

-Harry

Form class and tables are used by a specific Dynamics AX form/functional

Image
How to find out which Form class and tables are used by a specific Dynamics AX form/functional 
Hi Friends,


This Technique will help you every where when you need to find the back End of any form report.











This is a basic tip for developers who are starting with Dynamics AX. So, to find the form class and tables that are used by a functional process (like when you are executing and seeing an AX form), what we need to do first is to find out the form class name. To find the AOT form class name, open that form that's used in a process and Right-click on the form (over any record, for example) and select Setup. From there we can see the Form class definition and drill down to see all the tables it is using and so on.



















In red circle you found the table/Class name and its respective field.
For practice just  choose a form and try to find all related tables and used fields.
this will very help full for you to under stand the Form.


- Harry

Troubleshooting Error: No License code available for language

Image
Troubleshooting Error: No License code available for language EN-US. Please use a licensed language
Hi there,
 I was setting up an AX Instance from an existing  database backup and I hit this below error.
Error: No License code available for language EN-US. Please use a licensed language
Event Viewer Error: The Microsoft Dynamics AX Application Object Server is running on an operating system that is not supported. The supported operating system is Microsoft Windows Server 2003 with Service Pack 1.

Solution:
The language for the startup user needs to be setup as per the installation
update dbo.USERINFO set LANGUAGE = 'EN-AU', HELPLANGUAGE = 'EN-AU' where ID = 'Admin'

Enjoy...
Harry

How to Assig access rights in Axapta between users

How to Assig access rights in Axapta between users Assignment of access rights for the users is a very frequent task. This script helps to assign or replicate the access rights between users instantly.


// Script for assigning/swapping access rights between users.
static void assignAccessRights(Args _args)
{
UserGroupList groupList,groupListIns;
str 10 frmUser, toUser;
;

frmUser = 'usr1';
toUser = 'usr2' ;

// To delete the existing permissions of the toUser
delete_from groupList
where groupList.UserId == toUser;


while select groupList
where groupList.userId == frmUser
{
info(strfmt('Group assigned: %1',groupList.groupId));
select forupdate groupListIns
where groupListIns.userID == toUser
&& groupListIns.GroupId == groupList.GroupId;

if(!groupListIns)
{
groupListIns.UserId = toUser;
groupListIns.GroupId = groupList.GroupId;
groupListIns.insert();
}
}
info(strfmt('Permissions changed from: %1 to: %2',frmUser,toUser));
}

-Harry

Ax 2009 disk full error Cannot create temporary file: C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\appl\standard\tmp\$tmp001303e8.$.

Image
Ax 2009 disk full error Hi Friends
This problem only seems to occur on 64-bit operating systems and it can be very tricky to pin down the cause.... It occurs on both Terminal servers and Citrix Servers seemingly at random, we've noticed that the most consistent way to reproduce it (for this implementation at least) is by trying to generate a Customer Account Statement, but it can occur also occur when using Select Criteria, trying to generate a report, or when trying to view the permissions tree in a user group
The problem





Cannot create temporary file: C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\appl\standard\tmp\$tmp001303e8.$. The disk may be full.
Which is strange since the disk isn't full on the AOS server or the Citrix/Terminal server There is a workaround which is to run the Ax client as an Administrator but that can be a major security flaw and isn't a long term solution
The Cause There's a registry setting which tries to create a temporary sub-directory each t…

How to create a form with SimpleList-template

How to create a form with SimpleList-template... Follow these simple steps.....
Go to the AOT;Right-click the Forms-section and select the SimpleList-template;Then drag it to your project;The SimpleList-form is created, you will see a DataSource-section under the SimpleList-form;Drag and drop the table, you want to visualize on the SimpleList, to the DataSource-section of the form;Expand the Design-section of the SimpleList, you'll find the Grid-control;Finally select the Grid:Go to properties of the Grid to set the DataSource (this has to be the table that we've dropped);You also have to set the DataGroup (this is the fieldgroup or the fields of the table that we want to view);Save and open the form.

E-Book Morphx IT

Image
Introduction to Axapta X++ and the MorphX. [DUTCH & ENGLISH]
Hi friends,        this Ebook is really very help full for beginners developers. It contains a basic to high study material, with good examples.  This is available in two language. English and Dutch
Enjoy guys....



I would like to share with you this e-book, free for download.

The author of this book is Steen Andreasen (Steen's website) and is written in 2006.
E-book in ENGLISH: >>> Download English Version <<< E-book in DUTCH: >>> Download Dutch Version <<<

To download the examples that come from the exercises in the book: >>> Click here <<<

This is a good start to introduce yourself into the world of Axapta and X++. I hope this will be helpful for you!

Building a query object

Building a query object
Query objects are used to visually build SQL statements. They are used by Dynamics AX
reports, views, forms, and other objects. Normally queries are stored in AOT, but they can also be created from code dynamically. This is normally done when visual tools cannot handle complex and dynamic queries. In this recipe, we will create one dynamically from code. As an example, we will build a query that selects all active customers who belong to group 10 and have at least one sales order.
How to do it…
1. Open AOT, create a new job called CustTableSales, and enter the following code:


static void CustTableSales(Args _args) { Query query; QueryBuildDataSource qbds1; QueryBuildDataSource qbds2; QueryBuildRange qbr1; QueryBuildRange qbr2; QueryRun queryRun; CustTable custTable; ; query = new Query(); qbds1 = query.addDataSource(tablenum(CustTable)); qbds1.addSortField( fieldnum(CustTable, Name), SortOrder::Ascending); qbr1 = qbds1.addRange(fieldnum(CustTable,Blocked)); qbr1.valu…

How to open a form by using AX code

How to open a form by using AX code Hi Guys,

      Today we are going to open a form using code..just try following code
if(inventtable.Family == family::MettalicCore)
   {
   new MenuFunction(MenuItemDisplayStr(Attributes1),MenuItemType::Display).run();
    }
    else
    {
     new MenuFunction(MenuItemDisplayStr(Attributes),MenuItemType::Display).run();
     }
Here we are opening a form of Attributes1 and Attributes form its a simple way.Block Super()

Here is another way take a look


static void OpenFormByCodeB()
{ FormRun formRun;
Args args = new Args();
;
args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));

formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}

Now if we tweak this a little bit, we can add our code
Like this:

static void OpenFormByCodeB()
{ Object formRun;
Args args = new Args();
;
args.name(formstr(CustTable));
args.record(CustTable::find('ABC'));

formRun = ClassFactory.formRunClass(args);
formRun.init();

formRun.yourmethodgoeshe…

How export data to csv file in Ax 2009

How export data to csv file in Ax 2009 Hi friends ,

   Today we will learn how to exporting our  data from Ax 2009 to csv file format. The programming is done through X++ code. Change the code as per your requirements. Now we will have a simple example of writing the invent table to the csv file

public static void main(Args _args)
{
    Commaio file;
    container line;
    InventTable inventTable;
    #define.filename("C:\\dpk_Items.csv")
    #File

    ;
    file = new Commaio(#filename , #io_write); or  file = new Commaio(#filename , 'W');
    //file.outFieldDelimiter(';');
    if( !file || file.status() != IO_Status::Ok)
    {
        throw error("File Cannot be opened");
    }
    while select inventTable
    {
        line = [inventTable.ItemId,inventTable.ItemName];
        file.writeExp(line);
    }
}
You can save the document in any format such as doc,txt,xls only.

-Harry

Simple Dialog Box in Ax 2009

Simple Dialog Box Example in Ax 2009
Hi Friends , Today we are tring to develop a  simple DialogBox . try to following code

static void Simple_Dialog(Args _args)
{
dialog dlg;
dialogGroup dlgGroup;
dialogField dlgField;
; dlg = new dialog("Simple Dialog");
dlgGroup = dlg.addGroup("Customer");
dlgField = dlg.addField(TypeID(custAccount),"Account
Number"); if (dlg.run())
{
print dlgField.value();
pause;
}
}

-Harry