Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا
Showing posts with label Form work. Show all posts
Showing posts with label Form work. Show all posts

Thursday, June 27, 2013

Sequence of Form's Methods in Dynamics AX

This gives the information of method calls in the form level while
1. Opening the Form.
2. Creating/Updating/Deleting the record in the Form.
3. Closing the Form.
Sequence of Methods calls while opening the Form
Form — init ()
Form — Datasource — init ()
Form — run ()
Form — Datasource — execute Query ()
Form — Datasource — active ()
Sequence of Methods calls while closing the Form
Form — canClose ()
Form — close ()
Sequence of Methods calls while creating the record in the Form
Form — Datasource — create ()
Form — Datasource — initValue ()
Table — initValue ()
Form — Datasource — active ()
Sequence of Method calls while saving the record in the Form
Form — Datasource — ValidateWrite ()
Table — ValidateWrite ()
Form — Datasource — write ()
Table — insert ()
Sequence of Method calls while deleting the record in the Form
Form — Datasource — validatedelete ()
Table — validatedelete ()
Table — delete ()
Form — Datasource — active ()
Sequence of Methods calls while modifying the fields in the Form
Table — validateField ()

Table — modifiedField ()

Wednesday, June 26, 2013

Form controls belong to one of three groups, depending on their data source as follows:
  • ·         Bound control – associated with a field in an underlying table. Use bound controls to display, enter, and update values from fields in the database.
  • ·         Unbound control – does not have a data source. Use unbound controls to display pictures and static text.
  • ·         Calculated controls – uses a method as the data source. An example of a calculated control is the sum of two fields on a form.

 Example for Unbound Control
—->Here roles(Purpose) is a StringEdit control in the form. For this control, we should get the Drop down for selecting the Purpose
—-> Here the data we r getting from the lookup is not from the Datasource,that’s y we call this control as UNBOUND Controls
 SysLookupMultiSelectCtrl   rolesCtrl;
rolesCtrl = SysLookupMultiSelectCtrl::construct(element, roles, queryStr(LogisticsLocationRolePostalLookup), true, [tableNum(LogisticsLocationRoleTranslation), fieldNum(LogisticsLocationRoleTranslation, Description)]);

Wednesday, June 19, 2013

Sending email through Outlook in Dynamics AX

There are various ways by which we can send email in Dynamics AX. The code snippet shared here allows the user to send email through Microsoft Outlook using X++ code.The code is simple and easy to understand. 

    Description255             recipientEmail;
    Notes                            emailBody;
    Description255             subjectText;
    Filename                       fileName;
    SmmOutlookEmail         smmOutlookEmail = new SmmOutlookEmail();
  
    recipientEmail = "mdalfasith@gmail.com";
    subjectText     = "Test Email";
    fileName          = @"C:\Users\admin\Desktop\mypic.jpg";
    emailBody       = "Hi,\nThis is a test email for Dyanmics AX.\nThanks.";
  
    if (smmOutlookEmail.createMailItem())
    {
        smmOutlookEmail.addEMailRecipient(recipientEmail);
        smmOutlookEmail.addSubject(subjectText);
        smmOutlookEmail.addFileAsAttachment(fileName);
        smmOutlookEmail.addBodyText(emailBody);
        smmOutlookEmail.sendEMail(smmSaveCopyOfEMail::No,true);
    }
    else
    {
        error("Could not communicate with Microsoft Outlook Client.");
    }

So, if you want to send email directly without opening in Outlook, replace
smmOutlookEmail.sendEMail(smmSaveCopyOfEMail::No,true); 
with
smmOutlookEmail.sendEMail(smmSaveCopyOfEMail::No,false); 

Regards,

How to invoke and iterate List as Contract methods in AX 2012/ D365

Hi, Public void performContractIterate(ClassContainsListAsContract    _ListCarryClass) { List contractFieldList = new List(Types::Class); ...