July 26, 2012

How to split a Form in two window

hi Friends,
WE a going to create a new form and want to show this form in two interrelated windows, like the following form
Untitled
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 validation what ever is your requirement.

- Harry

Top 5 AIF Development Tips and Tricks

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 /*
2 runas(message.sourceEndpointAxUserId(),
3 classnum(AifInboundProcessingService),
4 staticmethodstr(AifInboundProcessingService, processAsUser),
5 [message.pack(), messageId]);
6 */
7 AifInboundProcessingService::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 the middle of developing:
clip_image002
AIF batch processing
So use a custom job to have the AIF run instantly at the click of a button, here is an example of the receive job:
01 static void runAIFReceive(Args _args)
02 {
03 AifGatewayReceiveService aifGatewayReceiveService;
04 AifInboundProcessingService aifInboundProcessingService;
05 ;
06
07 aifGatewayReceiveService = new AifGatewayReceiveService();
08 aifGatewayReceiveService.run();
09 aifInboundProcessingService = new AifInboundProcessingService();
10 aifInboundProcessingService.run(true);  // pass true for debug mode
11 }

3. Use file adapters
clip_image004
When using the AIF, you will most likely be using a Biztalk, Web service or MSMQ adapter. Testing actions using one of these adapters can be a pain as you will most likely require another program to send or receive the message.
To get around this you can use a file adapter during testing, so that you can just write the message in plain XML and drop the file into a directory on your file system to be processed.
Then when you are finished testing / developing you can easily swap the file adapter out.
4. Compose messages with the Visual Studio XML editor
During development (when you use a file adapter), you can create the message using notepad or any other text editor. I recommend using the Visual Studio XML editor to quickly compose these to take advantage of intellisense, schema validation and other useful features (like inserting a guid):
clip_image006
5. Use the pipeline
It is unlikely (if you are integrating with a third party) that the XML schemas  of the external system match those in AX.
To transform the message into the format AX can handle you can use the pipeline to add a component to run an xslt on the inbound XML:
clip_image008


Enjoy...
Harry