Saturday, July 14, 2018

Add an AOT Element to a Managed Code Project

Once a Managed code project is created in Visual Studio, Microsoft Dynamics
AX elements from the Application Explorer can be added to it. Simply drag an
element from the Application Explorer, into the project in the Solution Explorer.
Once dropped into the Solution Explorer, a node representing the element will be
in the project. These are referred to as proxies.
To demonstrate the connectivity with the AOT, the following code could now be
written in the C# class library.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassLibrary1
{
public class Class1
{
public string GetCustomerPaymentMode(string
accountNum,
string
dataAreaId)
{
string paymentMode = String.Empty;
CustTable custTable = new CustTable();
// Search for the customer.
custTable = CustTable.findByCompany(dataAreaId,
accountNum);
if (custTable.Found)
{
// Get the value for the customer's payment
mode.
paymentMode = custTable.PaymMode;
}
return paymentMode;
}
}
}

This example illustrates how the CustTable element is now used in the C# code.
An object of type
CustTable is instantiated and used to fetch a record from the
database. Notice the use of a method on the table object:
findByCompany().
Also notice that Visual Studio accepts the use of table fields, like
CustTable.PaymMode, as well as table methods.

Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...