AX2009

AX2009 – Find the assembly


To accomplish interoperation from your X++ code to assemblies that are managed by the Microsoft .NET common language runtime (CLR), you must correctly store the assemblies on your client computer.

You must then reference the assemblies by AOT > References > Add reference.

These configurations enable Microsoft Dynamics AX to find the assemblies at compile time and run time.


When you write X++ code that calls into a .NET assembly, you must make sure that the X++ compiler can find the assembly. You accomplish this by the following steps on the Microsoft Dynamics AX client computer:

  1. Copy your assembly into the client\bin\ directory under your Microsoft Dynamics AX installation directory.

    Your full path might resemble C:\Program Files\Microsoft Dynamics AX\<version>\client\bin\.

Note
Alternatively, you could copy your .NET assembly into the global assembly cache (GAC), if your assembly is signed.
  1. In the AOT, right-click References, and then click Add Reference.
  2. Click the Browse button.
  3. In the Select file dialog box, select your assembly file. Click Open.


You need to deploy your managed assemblies in different ways to support running on the client tier versus running on the Application Object Server (AOS) tier.

Running on the Client Tier

If your X++ method runs on the client tier, each client will need a copy of the assemblies that your code uses. Copy the assembly to the client\bin\ directory under your Microsoft Dynamics AX installation directory, or to the GAC if the assembly is signed.

Running on the AOS Tier

Your X++ code might be unable to run on the AOS tier, even though your X++ code compiles successfully on the client. A copy of each assembly that is needed by your X++ code must exist on each AOS computer for your X++ code to run on the AOS tier.

To run your X++ code on the AOS tier, you must copy your assembly to every AOS computer. The assembly can be copied into the server\…\bin\ subdirectory, which is located under the Microsoft Dynamics AX installation directory. Alternatively, the assembly can be copied into the GAC, if the assembly is signed.


Several Microsoft .NET Framework assemblies are already listed under AOT > References when Microsoft Dynamics AX is installed. This applies to both client and AOS installations.

Fără categorie

Functie validare adresa email


  1. In metoda validateField din tabelul CustTable:

 

case fieldnum(CustTable, Email) :

{

if (ret)

{

if(this.Email == ”)

ret = true;

else

{

// Remove spaces

this.Email = strreplace(this.Email, ” „, „”);

while(strendswith(this.Email, „,”))

{

this.Email = strdel(this.Email, strlen(this.Email), 1);

}

ret = CustTable::validateEmail(this.Email);

}

if(ret == false)

checkFailed(‘Adresa de email nu are formatul corect! (Ex: nume@companie.com)’);

}

break;

 

 

  1. Adauga functiile in tabelul CustTable:

 

static boolean validateEmail(str _email)

{

str emailRegex = @”^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$”;

str email;

List emailAddresses;

ListEnumerator enum;

System.Text.RegularExpressions.Regex regEx;

System.Text.RegularExpressions.Match regMatch;

InteropPermission permission = new InteropPermission(InteropKind::ClrInterop);

 

boolean retVal;

 

permission.assert();

 

//BP Deviation documented

regEx = new System.Text.RegularExpressions.Regex(emailRegex);

 

// Split the email address string and validate each email address

emailAddresses = CustTable::splitEmail(_email);

enum = emailAddresses.getEnumerator();

while(enum.moveNext())

{

email = enum.current();

 

if (email)

{

regMatch = regEx.Match(email);

retVal = regMatch.get_Success();

}

else

retVal = false;

 

// If a single email address is invalid, the string is invalid

if(!retVal)

break;

}

 

return retVal;

 

 

 

 

public static List splitEmail(str _email)

{

#DEFINE.EmailSplitter(„,”)

List emailAddresses;

;

emailAddresses = strsplit(_email, #EmailSplitter);

 

return emailAddresses;

}