/// <summary> /// The <c>SOLCustMarketingClearDataContract</c> contract for the job to clear customer marketing information. /// </summary> [DataContractAttribute] class SOLCustMarketingClearDataContract { str encodedQuery; [DataMemberAttribute, AifQueryTypeAttribute('_encodedQuery', queryStr(SOLCustMarketingQuery))] public str parmQuery(str _encodedQuery = encodedQuery) { encodedQuery = _encodedQuery; return encodedQuery; } }
/// <summary> /// The <c>SOLCustMarketingClearController</c> controller for the job to clear customer marketing information. /// </summary> class SOLCustMarketingClearController extends SysOperationServiceController { public ClassDescription caption() { ClassDescription ret; ret = "@SOLMod:ClearUnregisteredEmailAddresses"; return ret; } public LabelType parmDialogCaption(LabelType _dialogCaption = "") { LabelType caption; caption = "@SOLMod:ClearUnregisteredEmailAddresses"; return caption; } public static SOLCustMarketingClearController construct() { return new SOLCustMarketingClearController(); } public void getFromDialog() { //FormComboBoxControl mainAccountControl; //DialogForm theDialogForm; SOLCustMarketingClearDataContract contract; //theDialogForm = this.dialog().dialogForm(); super(); //mainAccountControl = theDialogForm.runControl(#MainAccount); contract = this.getDataContractObject(classStr(SOLCustMarketingClearDataContract)); if (contract) { // Set the values in data contract //contract.parmMainAccount(mainAccountControl.text()); } } public static void main(Args args) { SOLCustMarketingClearController controller; identifierName className; identifierName methodName; SysOperationExecutionMode executionMode; [className, methodName, executionMode] = SysOperationServiceController::parseServiceInfo(args); controller = new SOLCustMarketingClearController(className, methodName, executionMode); if (controller.prompt()) { controller.run(); } } }
/// <summary> /// The <c>SOLCustMarketingClearService</c> the job to clear customer marketing information. /// </summary> class SOLCustMarketingClearService { /// <summary> /// Clears unregistered customer email addresses /// </summary> /// <param name="_contract"> /// Job contract, contains query of records, which should be deleted /// </param> public void clearCustMarketing(SOLCustMarketingClearDataContract _contract) { Query q = new Query(SysOperationHelper::base64Decode(_contract.parmQuery())); QueryRun qr= new QueryRun(q); SOLCustMarketing custMarketing; int recordsDeleted; ttsbegin; while (qr.next()) { custMarketing = qr.get(tableNum(SOLCustMarketing)); custMarketing.selectForUpdate(true); custMarketing.delete(); recordsDeleted++; } info(strfmt("@SOLMod:NonRegCustRecordsDeleted", recordsDeleted)); ttscommit; } }
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.