Search code examples
web-servicesaxaptax++dynamics-ax-2012aif

How to make a simple getter via AIF in AX 2012?


I have a simple getter Class in AX and would like to use it via an AIF webservice from an external program. The Class looks like this:

static Email getEMail(HcmWorkerRecId _hcmWorkerRecId)
{
    ;
    email = HcmWorker::find(_hcmWorkerRecId).Email();
    return email;
}

What do I need to get an AIF Webservice out of it?


Solution

  • I just needed to add SysEntryPointAttribute Metadata attribute and set the method to public:

    [SysEntryPointAttribute]
    public Email getEMailByItemValueId(HcmWorkerRecId _hcmWorkerRecId)
    {
        ;
        email = HcmWorker::find(_hcmWorkerRecId).Email();
        return email;
    }
    

    Then I added an service and an service group and deployed it.

    A good help was this blogpost: http://dynamics-ax.blogspot.de/2011/08/microsoft-dynamics-ax-2012-dive-into_10.html