/// <summary> /// This is a BusinessEventContract class for Customer /// </summary> [DataContract] class VKCustTableBusinessEventContract extends BusinessEventsContract { SysAppCRUDOperation action; CustAccount custAccount; DataAreaId dataAreaId; private void initialize(CustTable _custTable, SysAppCRUDOperation _action) { custAccount = _custTable.AccountNum; dataAreaId = _custTable.DataAreaId; action = _action; } /// <summary> /// Create new VKCustTableBusinessEventContract from CustTable and action /// </summary> /// <param name = "_custTable">CustTable table</param> /// <param name = "_action">Action</param> /// <returns>a new VKCustTableBusinessEventContract</returns> public static VKCustTableBusinessEventContract newFromCustTable(CustTable _custTable, SysAppCRUDOperation _action) { VKCustTableBusinessEventContract contract = new VKCustTableBusinessEventContract(); contract.initialize(_custTable, _action); return contract; } protected void new() { } [DataMember('CustAccount'), BusinessEventsDatamember("CustAccount")] public CustAccount parmCustAccount(CustAccount _custAccount = custAccount) { custAccount = _custAccount; return custAccount; } [DataMember('Action'), BusinessEventsDatamember("Action")] public SysAppCRUDOperation parmAction(SysAppCRUDOperation _action = action) { action = _action; return action; } [DataMember('DataAreaId'), BusinessEventsDatamember("DataAreaId")] public DataAreaId parmDataAreaId(DataAreaId _dataAreaId = dataAreaId) { dataAreaId = _dataAreaId; return dataAreaId; } }
/// <summary> /// This is a BusinessEvent class for Customer /// </summary> [BusinessEvents(classStr(VKCustTableBusinessEventContract), "Customers CU", "Event for create, update", ModuleAxapta::General)] class VKCustTableBusinessEvent extends BusinessEventsBase { private CustTable custTable; SysAppCRUDOperation action; /// <summary> /// Create new VKCustTableBusinessEvent from CustTable and action /// </summary> /// <param name = "_custTable">CustTable table</param> /// <param name = "_action">Action</param> /// <returns>a new VKCustTableBusinessEvent</returns> public static VKCustTableBusinessEvent newFromCustTable(CustTable _custTable, SysAppCRUDOperation _action) { VKCustTableBusinessEvent businessEvent = new VKCustTableBusinessEvent(); businessEvent.parmAction(_action); businessEvent.parmCustTable(_custTable); return businessEvent; } private CustTable parmCustTable(CustTable _custTable = custTable) { custTable = _custTable; return custTable; } private SysAppCRUDOperation parmAction(SysAppCRUDOperation _action = action) { action = _action; return action; } protected void new() { } [Wrappable(true), Replaceable(true)] public BusinessEventsContract buildContract() { return VKCustTableBusinessEventContract::newFromCustTable(custTable, action); } }
/// <summary> /// Extension class for Custtable table /// </summary> [ExtensionOf(tableStr(CustTable))] final class VKCustTable_Extension { public void insert(DirPartyType _partyType, Name _name,boolean _updateCRM) { next insert(_partyType, _name, _updateCRM); if (BusinessEventsConfigurationReader::isBusinessEventEnabled(classStr(VKCustTableBusinessEvent)) && !CustTable::vkSkipByUserFilter()) { VKCustTableBusinessEvent::newFromCustTable(this, SysAppCRUDOperation::Create).send(); } } public void update(boolean _updateSmmBusRelTable, boolean _updateParty) { next update(_updateSmmBusRelTable, _updateParty); if (BusinessEventsConfigurationReader::isBusinessEventEnabled(classStr(VKCustTableBusinessEvent)) && !CustTable::vkSkipByUserFilter()) { VKCustTableBusinessEvent::newFromCustTable(this, SysAppCRUDOperation::Update).send(); } } /// <summary> /// Whether to skip sending business event or not /// </summary> /// <returns>true to skip sending BE</returns> public static boolean vkSkipByUserFilter() { boolean ret = false; // Use there real user id, which will be used for integration to avoid triggering update business event when external system updates the entity if ('Admin' == curUserId()) { ret = true; } return ret; } }
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.
Join us.