Send Text Message (SMS) from Dynamics AX.
Do you like this story?
The web services that are used by my code are provided by webSeerviceX.net. One would have to contact them for rights to use the service.
The wsdl for the web service can be found at: http://www.webservicex.net/sendsmsworld.asmx?wsdl
Currently only the following countries are services by the provider (i.e one can only send text messages to phones in these countries):
Austria, Croatia, Germany, Israel, Lithuania, Maldives, Norway, Switzerland, USA, Canada, France, India, Japan, Malaysia, New Zealand, Spain and Ukraine.
Unfortunately UK mobiles are not supported by the web service.
Anyways... this is how you can do it... click here to view the terms at which this code is to be used.
My form look like this... very basic...the idea was to make this as extensible as possible.. So others can reuse the code to fit their requirements.
the core work is done in a class: moTextFromAX J
I am using an XmlHttp com object to communicate with webServiceX..
Then the usual stuff ... add parm methods to pass variable through code in an efficient manner..
The above method is used to build the url, that is to be called... for more information on the url, visit the webServiceX website.
The next pic shows the code that actually links with webserviceX, sends the message and receives a reply from the web service.. as I said before I am using Microsoft.XMLHttp as the core integration component.
Rest is cosmetic work.. i.e. Form design..you are free to use this code directly on the main ax forms (CustTable, SalesTable, etc) ... I wanted to use a popup, which is why I created a new form.
I am defaulting 44 as the country code, I would suggest changing this to the county/region your client is based in...... its kinda silly of me to default 44 (UK country Phone code)... when UK is not supported by the web service..
The above code show how you can modify the init method to default the customers telephone number..that is if you add the new popup Text from to the customer Form...
In all honesty, I am basically trying to show you how you can streamline the process and default in as many values as possible... so the user won’t have to do the same thing twice.
Next comes the clicked method (on the ‘Send’ button).... very straight forward.... set the parm methods and call the sendText method, which in turn calls the build Url method and invokes the xmlHttp object.
and that’s all it take to make this integration work...
(Note: the message wasn’t sent, the service is not available in the UK yet)
Thanks for reading this post.
Download
This post was written by: Rahil Anouar
Rahil Anouar is a professional blogger, web designer and Linux user. Follow him on Twitter
0 Responses to “Send Text Message (SMS) from Dynamics AX.”
Post a Comment