wcfaxaptamicrosoft-dynamicsaif

How can I extend my WCF Service with new fields (Dynamics AX 2012)?


I'm trying to extend the HcmWorkerImportService; specifically I'm trying to add the modifiedBy and modifiedDateTime fields to the HcmPositionHierarchy table/class.

It is however not showing up when I update the service in my C#/WPF application. Google so far only turned up links that aren't applicable to this type of service (which is backed by classes).

Other classes that have been modified to include these fields have the following methods (which I copied to HcmWorkerImport_HcmPositionHierarchy but without success):

#define.ModifiedDateTime('ModifiedDateTime')
#define.ModifiedBy('ModifiedBy')

public boolean existsModifiedBy()
{
    return this.exists(#ModifiedBy);
}

public boolean existsModifiedDateTime()
{
    return this.exists(#ModifiedDateTime);
}

public ModifiedBy parmModifiedBy(ModifiedBy _value = '')
{
    if (!prmisdefault(_value))
    {
        this.set_Attribute(#ModifiedBy, _value);
    }

    return this.get_Attribute(#ModifiedBy);
}

public ModifiedDateTime parmModifiedDateTime(ModifiedDateTime _value = utcDateTimeNull())
{
    if (!prmisdefault(_value))
    {
        this.set_Attribute(#ModifiedDateTime, _value);
    }

    return this.get_Attribute(#ModifiedDateTime);
}

There does seem to be a query attached to the service and some search results suggest that I need to include the fields there as well. They have however already been included previously.


Solution

  • You need to manually create parm methods for ModifiedDateTime and ModifiedBy fields in AxBC class AxHcmPositionHierarchy. Please check the following link for example: http://axgrind.azurewebsites.net/2015/12/Adding-system-fields-to-AIF-Services/