SysExtension class factory

Attribute class, which will be used to attribute each class in the hierarchy and instantiate the correct one. Should extend SysAttribute.
class VKCallCenterIntegrationAttribute extends SysAttribute
{
    VKCallCenterIntegrationActivity activityId;
}
public void new(VKCallCenterIntegrationActivity _activityId)
{
    super();

    activityId = _activityId;
}
public VKCallCenterIntegrationActivity parmActivityId(VKCallCenterIntegrationActivity _activityId = activityId)
{
    activityId = _activityId;

    return activityId;
}
construct method of the base class, which based on the enum instantiate the right class from the hierarchy:
public static VKCallCenterIntegration construct(VKCallCenterIntegrationActivity _activityId, LanguageId _languageId, container _parameters)
{
    VKCallCenterIntegration             callCenterIntegration;
    VKCallCenterIntegrationAttribute    callCenterIntegrationAttribute;

    if(_activityId)
    {
        callCenterIntegrationAttribute = new VKCallCenterIntegrationAttribute(_activityId);
        callCenterIntegration = SysExtensionAppClassFactory::getClassFromSysAttribute(classStr(VKCallCenterIntegration), callCenterIntegrationAttribute);
    }

    if(callCenterIntegration == null)
    {
        throw error(strfmt("Unknown activity type %1", _activityId));
    }

    callCenterIntegration.parmLanguageId(_languageId);
    callCenterIntegration.parmParameters(_parameters);
    callCenterIntegration.parmActivityId(_activityId);
    callCenterIntegration.init();

    return callCenterIntegration;
}
Child classes in the hierarchy should mention attribute value:
[VKCallCenterIntegrationAttribute(VKCallCenterIntegrationActivity::ClickAndCollect)]
class VKCallCenterIntegrationClickAndCollect extends VKCallCenterIntegration
{
}
If the framework factory does not see your class (for example you renamed it), then execute the following URL:
/?cmp=dat&mi=SysClassRunner&cls=SysFlushAOD
Or from the main menu: System administration / Setup / Refresh elements
(clear cache, object cache)



 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units and "buy me a coffee" link.
Join us.

Blog Tags