Wednesday 26 September 2012

How to add a image to a form in Ax 2009

Hi Friends,

Today we are going to add a image to form below the grid to diplay the related image.


In class declaration of your form declare a FormWindowControl (variable name - itemImage) and add a method on form of to load the images,
the code for form is as follows


void loadImage()
{
    Image img;
    ;

    //where FormDataSource is the datasource holding image
    if (FormDataSource.Image)
    {
        img = new Image();
        img.setData(FormDataSource.Image);
        itemImage.image(img);
    }
    else
    {
        itemImage.image(null);
    }
}

overirde the init method of the form as shown below:-

public void init()
{
    ;

    super();
    itemImage = element.design().control(control::Window);
}


Take a button under menuitem buton and name it as "save as"
to save the image which u have created  take a new method on form and write the following code

void saveImage()
{
    Image    img;
    Filename name;
    str      type;
    #File
    ;

    img = new Image();

    type = '.'+strlwr(enum2value(img.saveType()));

    name = WinAPI::getOpenFileName(element.hWnd(), [WinAPI::fileType(type),#AllFilesName+type], '', '');

    if (name)
    {
        ttsbegin;
        img.loadImage(name);
        
        //where FormDataSource is the datasource holding image
         FormDataSource.Image = img.getData();
         FormDataSource.write();
        ttscommit;
    }
}


Now, override the active method of formdatasource and place the code as shown below:-

public int active()
{
    int ret;

    ret = super();

    element.loadImage();

    return ret;
}

Also, override the clicked method of "Save as" button created above and place the code as shown below:-

void clicked()
{
    super();
    element.saveImage();
}

Final step:- Add a window control on the tabpage\group or the place where u want to display the image.

Thanks.

Wednesday 5 September 2012

Setup Alerts in Dynamics Ax

This article describes how to set up Business Alerts in Microsoft Dynamics AX 4.0. This article also describes how to set the e-mail address from which Business Alert e-mail messages are sent.

MORE INFORMATION

Configure a user account to receive alerts

To configure a user account to receive alerts, follow these steps:
1. In the Navigation Pane, click Administration, and then click Users.
2. Select a user, and then click User Options.
3. Verify that the e-mail address where you want the user to receive alerts is in the E-mail field.
4. In the Receive alerts every (minutes) box, type 1.
5. In the Pop-up link destination list, click To alert.
6. In the Send alert as e-mail message list, click Define on each alert rule.
7. In the Show pop-ups list, click Define on each alert rule, and then click Apply.
8. Close the Options window.

Add the "E-mail distributor batch" job

The "E-mail distributor batch" job is the batch job that monitors and sends e-mail messages. To add the "E-mail distributor" batch job, follow these steps:
1. In the Navigation Pane, click Administration, expand Periodic, expand E-mail processing, and then click Batch.
2. In the "E-mail distributor batch" window, click Recurrence.
3. In the Recurrence window, click No end date.
4. Click Minutes.
5. In the Count box, type 1, and then click OK.
6. In the "E-mail distributor batch" window, click to select the Batch processing check box, and then click OK.Note You receive an Infolog message that resembles the following message:
Information: The E-mail distributor batch job is added to the batch queue.
7. Click Close to close the Infolog dialog box.
8. On the Tools menu, click Development tools, and then click Application Hierarchy Tree.
9. Expand Forms, and then double-click Tutorial_EventProcessor.
10. On the Tutorial_EventProcessor form, click Start, and then verify that the status is In waiting.

Set up a new alert rule

Alert rules define when alerts are sent and how they are received. To set up a new alert rule, follow these steps:
1. In the Navigation Pane, click General ledger, and then click Chart of accounts.
2. On the Overview tab, right-click a cell in the Account name column, and then click Create alert rule.
3. In the Alert me when area, select the field that you want to monitor with this alert rule in the Field list. For example, select Account name.
4. In the Event list, select the event that you want to trigger an alert. For example, select has changed.
5. In the Alert me for area, select the All records in Ledger chart of accounts option.
6. In the Alert me until area, select the No end date option.
7. In the Alert who area, select the user account that you want to receive this alert in the User ID list.
8. In the Also alert me by area, click to select the Show pop-ups check box.
9. Click to select the Send e-mail check box, and then click OK.
10. Close the "Manage alert rules" window.

Test the alert

To test the alert that you have set up, follow these steps:
1. In the Navigation Pane, click General ledger, and then click Chart of accounts.
2. On the Overview tab, change the name of the account for which you set up a new alert.
3. In the Navigation Pane, click Administration, click Periodic, click E-mail processing, and then click E-mail sending status.
4. The "E-mail sending status" window shows e-mail alerts that have been sent.

Set the e-mail address from which alerts are sent

You can set the e-mail address from which alerts are sent by selecting an e-mail template. To do this, follow these steps:
1. In the Navigation Pane, click Basic, click Alerts, and then click Alert parameters.
2. In the E-mail ID list, select the e-mail template from which you want e-mail alerts to be sent.