WINDOWS Live Search

To contact me for any clarifications regarding any posts / information, please mail me at arijit [dot] basu [at] gmail [dot] com

Wednesday, July 8, 2009

AX Email & URL Validation

All of you are aware that Standard AX does not carry out any validations on EMail addresses and URL's present in the contact details of BR/Cust/vend etc. However sometimes it becomes necessary to validate EMail addresses when they are entered in AX [DirECommunicationAddress] table. I was involved in a AX CRM implementation where it was required to validate email id's of contacts, BR when they are entered. Well if you consider the email validation piece, there are 2 parts:
1. Check if the EMail address is well formed
2. Check whether the well formed EMail id is valid.
For checking well formedness, you can use Regex (shown in this example) and for online validation of these emails, you can use any of the online email validation tools/ web services. For using online email validation web services, you can refer the whitepaper on 'Consuming external Web Services' by Helmut Wimmer
Well as for checking Well formedness, I created a small demo which validates email id's using regex:). The code is as below and is pretty simple. In this example I have used regex to validate email id's and URL's. The sample project is also attached as a download.

The small tool looks like this. There is a class in the project file which has 2 static methods that validates the input email/ url parameters using regex. You can change the regex match pattern.

The XPO and a small video is available for download below.

Well the main trick is to ensure that all emails entered in AX is validated, so just go ahead and check the method '\Data Dictionary\Maps\DirECommunicationMap\Methods\initCommInfoFromDirParty()'
You can extend the same to this method also and if you want have an online validation here as well.
Happy DAX-ing :-)


Helmut Wimmer said...

Hi Arijit,
thanks for mentioning my whitepaper.
Best regards,

Edvandro Santos said...

Has only one way to use RegExp in AX, through .NET Assembly? Thanks