Exportfile for AOT version 1.0 or later
Formatversion: 1
***Element: UTE
; Microsoft Dynamics AX Enum: NVMPEventRuleMultipleRecipients unloaded
; --------------------------------------------------------------------------------
USERTYPEVERSION 6
USERTYPE #NVMPEventRuleMultipleRecipients
ENUM
PROPERTIES
Name #NVMPEventRuleMultipleRecipients
Label #Use multiple recipients
HelpText #Use to specify multiple recipients for the alert's email
Extends #NoYesId
EnumType #NoYes
ENDPROPERTIES
TYPEELEMENTS
ENDTYPEELEMENTS
TYPEREFERENCES
ENDTYPEREFERENCES
ENDUSERTYPE
***Element: DBT
; Microsoft Dynamics AX Table : EventRule unloaded
; --------------------------------------------------------------------------------
TABLEVERSION 1
TABLE #EventRule
PROPERTIES
Name #EventRule
Label #@SYS99125
FormRef #EventRule
TitleField1 #RuleId
TitleField2 #Subject
TableContents #Base data
ConfigurationKey #Event
SecurityKey #BasicTables
CacheLookup #Found
CreateRecIdIndex #Yes
TableGroup #Main
PrimaryIndex #RuleIdx
ClusterIndex #RuleIdx
CreatedDateTime #Yes
DeveloperDocumentation #@SYS125271
ENDPROPERTIES
FIELDS
FIELD #RuleId
STRING
PROPERTIES
Name #RuleId
Mandatory #Yes
AllowEdit #No
Table #EventRule
ExtendedDataType
ARRAY
#EventRuleId
#
ENDARRAY
StringSize #20
ENDPROPERTIES
FIELD #Subject
STRING
PROPERTIES
Name #Subject
Table #EventRule
ExtendedDataType
ARRAY
#EventSubject
#
ENDARRAY
StringSize #128
ENDPROPERTIES
FIELD #Message
STRING
PROPERTIES
Name #Message
Table #EventRule
ExtendedDataType
ARRAY
#EventMessage
#
ENDARRAY
StringSize #255
ENDPROPERTIES
FIELD #UserId
STRING
PROPERTIES
Name #UserId
Mandatory #Yes
Table #EventRule
ExtendedDataType
ARRAY
#userId
#
ENDARRAY
StringSize #5
ENDPROPERTIES
FIELD #TypeId
INT
PROPERTIES
Name #TypeId
Mandatory #Yes
Table #EventRule
ExtendedDataType
ARRAY
#EventTypeId
#
ENDARRAY
ENDPROPERTIES
FIELD #AlertTableId
INT
PROPERTIES
Name #AlertTableId
Label #@SYS87632
HelpText #@SYS87631
Table #EventRule
ExtendedDataType
ARRAY
#RefTableId
#
ENDARRAY
ENDPROPERTIES
FIELD #AlertFieldId
INT
PROPERTIES
Name #AlertFieldId
Label #@SYS87629
HelpText #@SYS87630
Table #EventRule
ExtendedDataType
ARRAY
#fieldId
#
ENDARRAY
ENDPROPERTIES
FIELD #PrimTableId
INT
PROPERTIES
Name #PrimTableId
Label #@SYS87627
HelpText #@SYS87628
Mandatory #Yes
Table #EventRule
ExtendedDataType
ARRAY
#RefTableId
#
ENDARRAY
ENDPROPERTIES
FIELD #Until
ENUM
PROPERTIES
Name #Until
Table #EventRule
EnumType #EventUntil
ENDPROPERTIES
FIELD #Enabled
ENUM
PROPERTIES
Name #Enabled
Label #@SYS58636
HelpText #@SYS87626
Table #EventRule
ExtendedDataType
ARRAY
#NoYesId
#
ENDARRAY
EnumType #NoYes
ENDPROPERTIES
FIELD #AlertQbdsNo
INT
PROPERTIES
Name #AlertQbdsNo
Table #EventRule
ExtendedDataType
ARRAY
#EventDataSourceNo
#
ENDARRAY
ENDPROPERTIES
FIELD #FormName
STRING
PROPERTIES
Name #FormName
Mandatory #Yes
Table #EventRule
ExtendedDataType
ARRAY
#FormName
#
ENDARRAY
StringSize #40
ENDPROPERTIES
FIELD #TypeTrigger
ENUM
PROPERTIES
Name #TypeTrigger
Table #EventRule
EnumType #EventTypeTrigger
ENDPROPERTIES
FIELD #RuleCondition
ENUM
PROPERTIES
Name #RuleCondition
Table #EventRule
EnumType #EventRuleCondition
ENDPROPERTIES
FIELD #UntilDate
DATE
PROPERTIES
Name #UntilDate
Table #EventRule
ExtendedDataType
ARRAY
#EventUntilDate
#
ENDARRAY
ENDPROPERTIES
FIELD #AlertFieldLabel
STRING
PROPERTIES
Name #AlertFieldLabel
AllowEdit #No
Table #EventRule
ExtendedDataType
ARRAY
#EventFieldLabel
#
ENDARRAY
StringSize #250
ENDPROPERTIES
FIELD #ActionIds
QUEUE
PROPERTIES
Name #ActionIds
Label #@SYS94916
HelpText #@SYS94917
Table #EventRule
ExtendedDataType
ARRAY
#Blobdata
#
ENDARRAY
ENDPROPERTIES
FIELD #DeleteRefRecId
INT64
PROPERTIES
Name #DeleteRefRecId
Label #@SYS87910
HelpText #@SYS80146
Table #EventRule
ExtendedDataType
ARRAY
#EventRefRecId
#
ENDARRAY
ENDPROPERTIES
FIELD #ShowPopup
ENUM
PROPERTIES
Name #ShowPopup
Label #@SYS87695
HelpText #@SYS94033
Table #EventRule
EnumType #NoYes
ENDPROPERTIES
FIELD #SendEmail
ENUM
PROPERTIES
Name #SendEmail
Label #@SYS94049
HelpText #@SYS94034
Table #EventRule
EnumType #NoYes
ENDPROPERTIES
FIELD #IsAggregated
ENUM
PROPERTIES
Name #IsAggregated
Table #EventRule
ExtendedDataType
ARRAY
#EventIsAggregated
#
ENDARRAY
EnumType #NoYes
ENDPROPERTIES
ENDFIELDS
GROUPS
GROUP #AutoReport
PROPERTIES
Name #AutoReport
ENDPROPERTIES
GROUPFIELDS
#RuleId
#Subject
#Message
#Enabled
#Until
#UntilDate
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #AlertedBy
PROPERTIES
Name #AlertedBy
Label #@SYS94032
ENDPROPERTIES
GROUPFIELDS
#ShowPopup
#SendEmail
ENDGROUPFIELDS
ENDGROUP
GROUP #AlertOwner
PROPERTIES
Name #AlertOwner
Label #@SYS87992
ENDPROPERTIES
GROUPFIELDS
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #AlertTexts
PROPERTIES
Name #AlertTexts
Label #@SYS87777
ENDPROPERTIES
GROUPFIELDS
#Subject
#Message
ENDGROUPFIELDS
ENDGROUP
GROUP #Context
PROPERTIES
Name #Context
Label #@SYS76571
ENDPROPERTIES
GROUPFIELDS
#FormName
#RuleCondition
ENDGROUPFIELDS
ENDGROUP
GROUP #Identification
PROPERTIES
Name #Identification
Label #@SYS5711
ENDPROPERTIES
GROUPFIELDS
#RuleId
#Subject
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #Overview
PROPERTIES
Name #Overview
Label #@SYS9039
ENDPROPERTIES
GROUPFIELDS
#Subject
#Enabled
#Until
#UntilDate
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #Setup
PROPERTIES
Name #Setup
Label #@SYS2186
ENDPROPERTIES
GROUPFIELDS
#Until
#UntilDate
#Message
ENDGROUPFIELDS
ENDGROUP
GROUP #Status
PROPERTIES
Name #Status
Label #@SYS25587
ENDPROPERTIES
GROUPFIELDS
#Enabled
ENDGROUPFIELDS
ENDGROUP
GROUP #System
PROPERTIES
Name #System
Label #@SYS4278
ENDPROPERTIES
GROUPFIELDS
#AlertTableId
#AlertFieldId
#AlertFieldLabel
#PrimTableId
#TypeId
#TypeTrigger
#AlertQbdsNo
#DeleteRefRecId
#IsAggregated
ENDGROUPFIELDS
ENDGROUP
ENDGROUPS
INDICES
#RuleIdx
PROPERTIES
Name #RuleIdx
AllowDuplicates #No
ENDPROPERTIES
INDEXFIELDS
#RuleId
ENDINDEXFIELDS
#UserIdx
PROPERTIES
Name #UserIdx
ENDPROPERTIES
INDEXFIELDS
#UserId
#RuleId
ENDINDEXFIELDS
#AlertTableIdIdx
PROPERTIES
Name #AlertTableIdIdx
ENDPROPERTIES
INDEXFIELDS
#AlertTableId
ENDINDEXFIELDS
ENDINDICES
REFERENCES
REFERENCE #DeleteRefRecId
PROPERTIES
Name #DeleteRefRecId
Table #Common
EntityRelationshipRole #@SYS125272
ENDPROPERTIES
FIELDREFERENCES
REFERENCETYPE NORMAL
PROPERTIES
Field #DeleteRefRecId
RelatedField #RecId
ENDPROPERTIES
ENDFIELDREFERENCES
ENDREFERENCE
ENDREFERENCES
DELETEACTIONS
#NVMPEventRuleRecipients
PROPERTIES
Table #NVMPEventRuleRecipients
DeleteAction #Cascade
ENDPROPERTIES
#EventRuleIgnoreAggregation
PROPERTIES
Table #EventRuleIgnoreAggregation
DeleteAction #Cascade
ENDPROPERTIES
#EventRuleData
PROPERTIES
Table #EventRuleData
DeleteAction #Cascade
ENDPROPERTIES
#EventRuleRel
PROPERTIES
Table #EventRuleRel
DeleteAction #Cascade
ENDPROPERTIES
#EventRuleField
PROPERTIES
Table #EventRuleField
DeleteAction #Cascade
ENDPROPERTIES
#EventRuleIgnore
PROPERTIES
Table #EventRuleIgnore
DeleteAction #Cascade
ENDPROPERTIES
ENDDELETEACTIONS
METHODS
Version: 3
SOURCE #alertField
#container alertField(container _alertField = connull())
#{
# if (prmisdefault(_alertField))
# return EventRuleData::find(this.RuleId,EventRuleDataType::AlertField).Data;
# else
# {
# this.ruleDataWrite(EventRuleDataType::AlertField,_alertField);
# return _alertField;
# }
#}
ENDSOURCE
SOURCE #alertTableLabel
#//BP Deviation documented
#display TableLabel alertTableLabel()
#{
# return tableid2pname(this.AlertTableId);
#}
ENDSOURCE
SOURCE #buildSubject
#EventSubject buildSubject(
# container _xContainer
# )
#{
# EventSubject subject;
# EventType eventType;
# anytype xValue;
# ;
# eventType = this.TypeId ? EventType::construct(this.TypeId,this.TypeTrigger) : null;
#
# if (eventType)
# {
# if (eventType.isFieldRelated())
# {
# xValue = _xContainer && conlen(_xContainer) == 1 ? conpeek(_xContainer,1) : null;
# subject = strfmt("@SYS87953",this.AlertFieldLabel,this.primTableLabel(),eventType.caption(),
# eventType.isRequeringX() && xValue ? xValue : '');
# }
# else
# {
# subject = strfmt("@SYS87954",eventType.caption(),this.primTableLabel());
# }
# }
# return subject;
#}
ENDSOURCE
SOURCE #checkFilterAccess
#boolean checkFilterAccess(container _packedQuery)
#{
# if (!this.UserId)
# return true;
#
# if (!SysQuery::isPackedOk(_packedQuery))
# return checkFailed(strfmt("@SYS68912",funcname()));
#
# return EventSecurity::construct(this.UserId).isFilterAccessible(new Query(_packedQuery)) ? true : checkFailed(strfmt("@SYS91449",this.UserId));
#}
ENDSOURCE
SOURCE #contextInfo
#EventContextInfo contextInfo(container _value = connull())
#{
# if (prmisdefault(_value))
# return EventRuleData::find(this.RuleId,EventRuleDataType::Context).Data;
# else
# {
# this.ruleDataWrite(EventRuleDataType::Context,_value);
# return _value;
# }
#}
ENDSOURCE
SOURCE #createCompanyRuleEntry
#void createCompanyRuleEntry(CompanyId _companyId, userId _userId)
#{
# EventCompanyRule companyRule;
# ;
#
# if (EventCompanyRule::exist(_companyId,_userId))
# return;
#
# ttsbegin;
#
# companyRule.selectForUpdate(true);
# companyRule.CompanyId = _companyId;
# companyRule.UserId = _userId;
# companyRule.insert();
#
# ttscommit;
#
#
#}
ENDSOURCE
SOURCE #createDbLogForRecordType
#// This method only creates databaseLog records for rules using EventTypeRecord or childs.
#private void createDbLogForRecordType()
#{
# boolean doFlush;
# EventType eventType;
# ;
# if (!this.TypeId)
# return;
#
# eventType = EventType::construct(this.TypeId,this.TypeTrigger);
#
# if (eventType.mustLogRecordDeleted())
# {
# xDatabaseLog::eventTestCreate(DatabaseLogType::EventDelete,this.AlertTableId);
# doFlush = true;
# }
# if (eventType.mustLogRecordInserted())
# {
# xDatabaseLog::eventTestCreate(DatabaseLogType::EventInsert,this.AlertTableId);
# doFlush = true;
# }
# if (doFlush)
# SysFlushDatabaseLogSetup::main();
#}
ENDSOURCE
SOURCE #delete
#public void delete()
#{
#;
# ttsbegin;
#
# this.deleteDbLogForRecordType();
#
# super();
#
# this.deleteCompanyRuleEntry(this.DataAreaId,this.UserId);
#
# ttscommit;
#}
ENDSOURCE
SOURCE #deleteCompanyRuleEntry
#void deleteCompanyRuleEntry(CompanyId _companyId, userId _userId)
#{
# EventRule tstRule;
# EventCompanyRule companyRule;
#
# ;
#
# if (!EventCompanyRule::exist(_companyId, _userId))
# return;
#
# // Check if there are any rules left for that company
# select tstRule
# where tstRule.DataAreaId == _companyId &&
# tstRule.UserId == _userId;
#
# if (tstRule)
# return;
#
# ttsbegin;
# companyRule = EventCompanyRule::find(_companyId,_userId, true);
# companyRule.delete();
# ttscommit;
#
#}
ENDSOURCE
SOURCE #deleteDbLogForRecordType
#// This method only deletes databaseLog records for rules using EventTypeRecord or childs.
#private void deleteDbLogForRecordType()
#{
# EventRule tstRule;
# DatabaseLog dbLog;
#
# CompanyDomainList domainList;
# DatabaseLogType logType;
#
# if (this.TypeTrigger != EventTypeTrigger::RecordInsert &&
# this.TypeTrigger != EventTypeTrigger::RecordDelete
# )
# {
# return;
# }
#
# // Check if another rule is using the same table
# select tstRule
# where tstRule.TypeTrigger == this.TypeTrigger
# && tstRule.AlertTableId == this.AlertTableId
# && tstRule.RecId != this.RecId;
# if (tstRule)
# return;
#
# if (this.TypeTrigger == EventTypeTrigger::RecordInsert)
# logType = DatabaseLogType::EventInsert;
# else
# logType = DatabaseLogType::EventDelete;
#
#
# while select domainList where
# domainList.CompanyId == curext()
# {
# ttsbegin;
# dbLog = xDatabaseLog::find(domainList.DomainId,logType,this.AlertTableId,0,true);
#
# if (dbLog)
# dbLog.delete();
# ttscommit;
# }
#
# SysFlushDatabaseLogSetup::main();
#}
ENDSOURCE
SOURCE #disableIfExpired
#public boolean disableIfExpired(
# TransDate _curTransDate
# )
#{
# #OCCRetryCount
#
# if (!this.selectForUpdate())
# throw error(strfmt("@SYS68912",funcname()));
#
# try
# {
#
# if (this.Until == EventUntil::UntilDate && this.UntilDate < _curTransDate)
# {
# this.Enabled = NoYes::No;
# this.update();
# return true;
# }
# }
# catch(Exception::Deadlock)
# {
# this.reread();
# if (this.Until == EventUntil::UntilDate && this.UntilDate < _curTransDate &&
# this.Enabled == NoYes::Yes)
# retry;
# else
# return true;
# }
# catch (Exception::UpdateConflict)
# {
# if (appl.ttsLevel() == 0)
# {
# if (xSession::currentRetryCount() >= #RetryNum)
# {
# throw Exception::UpdateConflictNotRecovered;
# }
# else
# {
# if (this.Until == EventUntil::UntilDate && this.UntilDate < _curTransDate &&
# this.Enabled == NoYes::Yes)
# retry;
# else
# return true;
# }
# }
# else
# {
# throw Exception::UpdateConflict;
# }
# }
#
# return false;
#}
ENDSOURCE
SOURCE #eventType
#EventType eventType()
#{
# if (! this.TypeId)
# return null;
#
# return EventType::construct(this.TypeId,this.TypeTrigger);
#}
ENDSOURCE
SOURCE #filter
#container filter(container _filter = connull())
#{
# if (prmisdefault(_filter))
# return EventRuleData::find(this.RuleId,EventRuleDataType::Filter).Data;
# else
# {
# this.ruleDataWrite(EventRuleDataType::Filter,_filter);
# return _filter;
# }
#}
ENDSOURCE
SOURCE #filterQuery
#Query filterQuery(Query _query = null)
#{
# if (prmisdefault(_query))
# return new Query(this.filter());
# else
# {
# this.filter(_query.pack(false));
# return _query;
# }
#}
#
ENDSOURCE
SOURCE #getDurationFieldText
#//BP Deviation documented
#display EPEventRuleDuration getDurationFieldText()
#{
# SysDictField dictField = new SysDictField(tablenum(EventRule),fieldnum(EventRule,Until));
# SysDictEnum dictEnum = new SysDictEnum(dictField.enumId());
# return dictEnum.value2Label(this.Until);
#}
ENDSOURCE
SOURCE #getRuleStatus
#//BP Deviation documented
#display EPEventRuleStatus getRuleStatus()
#{
# if (this.Enabled)
# return "@SYS58636";
# else
# return "@SYS88623";
#}
ENDSOURCE
SOURCE #initFromTmpEventAlertField
#void initFromTmpEventAlertField(
# TmpEventAlertField _tmpEventAlertField
# )
#{
# this.AlertFieldId = _tmpEventAlertField.RefFieldId;
# this.AlertTableId = _tmpEventAlertField.RefTableId ? _tmpEventAlertField.RefTableId : this.PrimTableId;
# this.AlertFieldLabel = _tmpEventAlertField.Label;
#}
ENDSOURCE
SOURCE #initFromTmpEventType
#void initFromTmpEventType(
# TmpEventType _tmpEventType
# )
#{
# this.TypeId = _tmpEventType.TypeId;
# this.TypeTrigger = _tmpEventType.TypeTrigger;
#}
ENDSOURCE
SOURCE #initValue
#public void initValue()
#{
# super();
#
# this.UserId = curuserid();
#
#}
ENDSOURCE
SOURCE #insert
##Event
#public void insert()
#{
#
# EventParameters eventParameters;
#;
# ttsbegin;
#
# this.RuleId = this.RuleId ? this.RuleId : NumberSeq::newGetNum(CompanyInfo::numRefParmId()).num();
#
# if (!EventParameters::find())
# {
# ttsbegin;
# eventParameters = EventParameters::find(true);
# eventParameters.update();
# ttscommit;
# }
#
# this.createDbLogForRecordType();
#
# if (!this.isTmp())
# this.createCompanyRuleEntry(this.DataAreaId, this.UserId);
#
# super();
#
# ttscommit;
#}
ENDSOURCE
SOURCE #isDueDateRule
#boolean isDueDateRule()
#{
# return SysDictClass::isEqualOrSuperclass(this.TypeId,classnum(EventTypeDue));
#}
ENDSOURCE
SOURCE #isFilterInteractive
#boolean isFilterInteractive()
#{
# return this.TypeId && !EventType::construct(this.TypeId,this.TypeTrigger).isFilterInteractive() ? false : true;
#}
ENDSOURCE
SOURCE #primTableLabel
#//BP Deviation documented
#display EventTableLabel primTableLabel()
#{
# return this.PrimTableId ? new SysDictTable(this.PrimTableId).label() : '';
#}
ENDSOURCE
SOURCE #ruleDataWrite
#private void ruleDataWrite(
# EventRuleDataType _dataType,
# container _data
# )
#{
# EventRuleData eventRuleData;
#;
# eventRuleData = EventRuleData::find(this.RuleId,_dataType,true);
# eventRuleData.RuleId = this.RuleId;
# eventRuleData.DataType = _dataType;
# eventRuleData.Data = _data;
#
# if (eventRuleData.RecId)
# {
# eventRuleData.update();
# }
# else
# {
# eventRuleData.insert();
# }
#}
ENDSOURCE
SOURCE #setDeleteRefRecId
#void setDeleteRefRecId(
# Common _callerRecord
# )
#{
# this.DeleteRefRecId = _callerRecord.RecId && this.RuleCondition == EventRuleCondition::Current ? _callerRecord.RecId : 0;
#}
ENDSOURCE
SOURCE #setSubject
#void setSubject(
# container _xContainer
# )
#{
# this.Subject = this.buildSubject(_xContainer);
#}
ENDSOURCE
SOURCE #typeIdLabel
#//BP Deviation documented
#display ClassDescription typeIdLabel()
#{
# return EventType::construct(this.TypeId,this.TypeTrigger).description();
#}
ENDSOURCE
SOURCE #typeValue
#EventTypeValue typeValue(container _value = connull())
#{
# if (prmisdefault(_value))
# return EventRuleData::find(this.RuleId,EventRuleDataType::TypeValue).Data;
# else
# {
# this.ruleDataWrite(EventRuleDataType::TypeValue,_value);
# return _value;
# }
#}
ENDSOURCE
SOURCE #update
#public void update()
#{
# boolean isOwnerChanged;
# userId oldRuleOwner;
#
#;
# ttsbegin;
#
# // Note that an update may be part of a larger transaction, e.g. during event processing.
#
# this.createDbLogForRecordType();
#
# isOwnerChanged = this.orig().UserId != this.UserId;
#
# if (isOwnerChanged)
# oldRuleOwner = this.orig().UserId;
#
# super();
#
# if (isOwnerChanged)
# {
# this.deleteCompanyRuleEntry(curext(),oldRuleOwner);
# this.createCompanyRuleEntry(curext(),this.UserId);
# }
#
# ttscommit;
#}
ENDSOURCE
SOURCE #A4AInvalidTables
#// This method builds a set of tableId's that does not allow for Rule creation
#static client server container a4aInvalidTables()
#{
# Set invalidTableSet = new Set(Types::Integer);
# ;
# invalidTableSet.add(tablenum(EventInbox));
# invalidTableSet.add(tablenum(EventInboxData));
# invalidTableSet.add(tablenum(EventCUD));
# invalidTableSet.add(tablenum(InventSum));
# // Add further tables here
# // ....
# return invalidTableSet.pack();
#}
ENDSOURCE
SOURCE #canShowCreateRuleMenuItem
#static public client boolean canShowCreateRuleMenuItem(FormRun _caller)
#{
# boolean ret;
# ;
# ret = hasMenuItemAccess(menuitemactionstr(EventCreateRule),MenuItemType::Action);
# ret = ret && EventCreateRule::newCheckFormRun(_caller);
#
# return ret;
#}
ENDSOURCE
SOURCE #changeDomainLicenseKey
#static public server void changeDomainLicenseKey(
# EnableDisable _enableDisable
# )
#{
# #OCCRetryCount
# DictConfigurationKey dictConfigurationKey = new DictConfigurationKey(configurationkeynum(Event));
# EventRule eventRule;
# EventRuleField eventRuleField;
# DataArea dataArea;
# boolean updateRules;
# SysDictField df;
# SysDictTable dt;
# Integer arrIdx;
# ;
# if (!dictConfigurationKey || !dictConfigurationKey.enabled())
# return;
#
# if (!isRunningMode())
# return;
#
# try
# {
# ttsbegin;
#
# while select dataArea where
# dataArea.IsVirtual == false
# {
# updateRules = false;
#
# changecompany(dataArea.Id)
# {
#
# if (_enableDisable == EnableDisable::Enable)
# {
# while select forupdate eventRule
# index RuleIdx
# {
# eventRule.update();
# }
# while select eventRuleField
# {
# arrIdx = fieldExt2Idx(eventRuleField.uFieldId);
# df = new SysDictField(eventRuleField.uTableId,eventRuleField.uFieldId,arrIdx);
# dt = new SysDictTable(eventRuleField.uTableId);
#
# if (df && df.mandatory() && dt.primaryKeyField() == fieldExt2Id(df.id()))
# xDatabaseLog::eventTestCreate(DatabaseLogType::EventRenameKey,eventRuleField.uTableId,eventRuleField.uFieldId);
# else
# xDatabaseLog::eventTestCreate(DatabaseLogType::EventUpdate,eventRuleField.uTableId,eventRuleField.uFieldId);
# }
# }
# }
# }
# ttscommit;
# }
# catch (Exception::Deadlock)
# {
# retry;
# }
# catch (Exception::UpdateConflict)
# {
# if (appl.ttsLevel() == 0)
# {
# if (xSession::currentRetryCount() >= #RetryNum)
# {
# throw Exception::UpdateConflictNotRecovered;
# }
# else
# {
# retry;
# }
# }
# else
# {
# throw Exception::UpdateConflict;
# }
# }
#}
ENDSOURCE
SOURCE #checkExist
#static boolean checkExist(EventRuleId _eventRuleId)
#{
# if (_eventRuleId && !EventRule::exist(_eventRuleId))
# return checkFailed(strfmt(EventRule::txtNotExist(),_eventRuleId));
# return true;
#}
#
ENDSOURCE
SOURCE #exist
#static boolean exist(EventRuleId _eventRuleId)
#{
# return _eventRuleId && (select RecId from eventrule
# index hint RuleIdx
# where eventrule.RuleId == _eventRuleId
# ).RecId != 0;
#}
#
ENDSOURCE
SOURCE #find
#static EventRule find(EventRuleId _eventRuleId,
# boolean _forupdate = false,
# ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
#{
# EventRule eventRule;
#
# if (_eventRuleId)
# {
# if (_forupdate)
# {
# eventRule.selectForUpdate(_forupdate);
# if (_concurrencyModel != ConcurrencyModel::Auto)
# eventRule.concurrencyModel(_concurrencyModel);
# }
#
# select eventRule
# where eventRule.RuleId == _eventRuleId;
# }
# return eventRule;
#}
#
ENDSOURCE
SOURCE #name
#static EventSubject name(EventRuleId _eventRuleId)
#{
# return EventRule::find(_eventRuleId).Subject;
#}
#
ENDSOURCE
SOURCE #recordTemplatesExist
#static client boolean recordTemplatesExist(boolean _forceExtendedCheck)
#{
# SysRecordTmpTemplate sysRecordTmpTemplateLimit;
# SysRecordTemplateTable sysRecordTemplateTable = SysRecordTemplateTable::find(tablenum(EventRule));
#
# #Define.maxTemplatesSimpleCheck(10)
# ;
# if (!sysRecordTemplateTable.RecId || !sysRecordTemplateTable.Data || conlen(sysRecordTemplateTable.Data) <= 1)
# return false;
#
# if (!_forceExtendedCheck && conlen(sysRecordTemplateTable.Data)+1 > #maxTemplatesSimpleCheck)
# return true;
#
# sysRecordTmpTemplateLimit.setTmpData(SysRecordTmpTemplate::sysRecordTmpTemplateLimit(tablenum(EventRule),sysRecordTemplateTable.Data));
#
# select count(RecId) from sysRecordTmpTemplateLimit;
#
# return conlen(sysRecordTemplateTable.Data) - sysRecordTmpTemplateLimit.RecId > 1 ? true : false;
#}
ENDSOURCE
SOURCE #txtNotExist
#static TxtNotExist txtNotExist()
#{
# return "@SYS87622";
#}
#
ENDSOURCE
SOURCE #viewCreateRuleDialog
#static public client void viewCreateRuleDialog(FormRun _caller)
#{
# Args args;
# ;
# if (!hasMenuItemAccess(menuitemactionstr(EventCreateRule),MenuItemType::Action))
# return;
# args = new Args();
# args.caller(_caller);
# args.parmObject(_caller);
# new MenuFunction(menuitemdisplaystr(EventRule),MenuItemType::Display).run(args);
#
#/*
# Args args;
# ;
# if (!hasMenuItemAccess(menuitemactionstr(EventCreateRule),MenuItemType::Action))
# return;
# args = new Args();
# args.caller(_caller);
# new MenuFunction(menuitemactionstr(EventCreateRule),MenuItemType::Action).run(args);
#*/
#}
ENDSOURCE
ENDMETHODS
ENDTABLE
***Element: DBT
; Microsoft Dynamics AX Table : NVMPEventRuleRecipients unloaded
; --------------------------------------------------------------------------------
TABLEVERSION 1
TABLE #NVMPEventRuleRecipients
PROPERTIES
Name #NVMPEventRuleRecipients
Label #Event rule recipients
FormRef #NVMPEventRuleReceipients
TitleField1 #EventRuleId
TitleField2 #UserId
CacheLookup #FoundAndEmpty
TableGroup #WorksheetLine
PrimaryIndex #EventRuleUserdIdx
ClusterIndex #EventRuleUserdIdx
ENDPROPERTIES
FIELDS
FIELD #EventRuleId
STRING
PROPERTIES
Name #EventRuleId
Mandatory #Yes
AllowEdit #No
Table #NVMPEventRuleRecipients
ExtendedDataType
ARRAY
#EventRuleId
#
ENDARRAY
StringSize #20
ENDPROPERTIES
FIELD #UserId
STRING
PROPERTIES
Name #UserId
Mandatory #Yes
AllowEdit #No
Table #NVMPEventRuleRecipients
ExtendedDataType
ARRAY
#userId
#
ENDARRAY
StringSize #5
ENDPROPERTIES
ENDFIELDS
GROUPS
GROUP #AutoReport
PROPERTIES
Name #AutoReport
ENDPROPERTIES
GROUPFIELDS
#EventRuleId
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #Identification
PROPERTIES
Name #Identification
Label #@SYS5711
ENDPROPERTIES
GROUPFIELDS
#EventRuleId
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #Overview
PROPERTIES
Name #Overview
Label #@SYS9039
ENDPROPERTIES
GROUPFIELDS
#EventRuleId
#UserId
ENDGROUPFIELDS
ENDGROUP
GROUP #User
PROPERTIES
Name #User
Label #@SYS16181
ENDPROPERTIES
GROUPFIELDS
#UserId
#userName
ENDGROUPFIELDS
ENDGROUP
ENDGROUPS
INDICES
#EventRuleUserdIdx
PROPERTIES
Name #EventRuleUserdIdx
AllowDuplicates #No
ENDPROPERTIES
INDEXFIELDS
#EventRuleId
#UserId
ENDINDEXFIELDS
ENDINDICES
REFERENCES
ENDREFERENCES
DELETEACTIONS
ENDDELETEACTIONS
METHODS
Version: 3
SOURCE #userName
#// BP Deviation Documented
#public display UserName userName()
#{
# ;
# return ( select firstonly Id, Name
# from userInfo
# where userInfo.id == this.UserId ).Name;
#
#}
ENDSOURCE
SOURCE #checkExist
#public static Boolean checkExist(EventRuleId _eventRuleId,
# userId _userId)
#{
# Boolean ret = true;
# ;
#
# if (!NVMPEventRuleRecipients::exist(_eventRuleId, _userId))
# {
# ret = checkFailed(strfmt(NVMPEventRuleRecipients::txtNotExist(), _eventRuleId, _userId));
# }
#
# return ret;
#}
ENDSOURCE
SOURCE #exist
#public static Boolean exist(EventRuleId _eventRuleId,
# userId _userId)
#{
# return (NVMPEventRuleRecipients::find(_eventRuleId, _userId).RecId != 0);
#}
ENDSOURCE
SOURCE #find
#public static NVMPEventRuleRecipients find(EventRuleId _eventRuleId,
# userId _userId,
# Boolean _forUpdate = false)
#{
# NVMPEventRuleRecipients nvmpEventRuleRecipients;
# ;
#
# if (_eventRuleId && _userId)
# {
# nvmpEventRuleRecipients.selectForUpdate(_forUpdate);
#
# select firstonly nvmpEventRuleRecipients
# index hint EventRuleUserdIdx
# where nvmpEventRuleRecipients.EventRuleId == _eventRuleId &&
# nvmpEventRuleRecipients.UserId == _userId;
# }
#
# return nvmpEventRuleRecipients;
#}
ENDSOURCE
SOURCE #sendMail
#static void sendMail( EventRuleId _eventRuleId,
# SysEmailId _AlertTemplateId,
# Map _mappings = null,
# str _xmlParamters = ''
# )
#{
# NVMPEventRuleRecipients recipients;
# SysUserInfo sysUserInfo;
# UserInfo userInfo;
# ;
#
# while select UserId
# from recipients
# where recipients.EventRuleId == _eventRuleId
# {
# // SysUserInfo has Alert and email info
# sysUserInfo = SysUserInfo::find(recipients.UserId);
#
# // UserInfo has the language info
# userInfo = xUserInfo::find(false, recipients.UserId);
#
# SysEmailTable::sendMail(_AlertTemplateId, userInfo.Language, sysUserInfo.Email, _mappings, '', _xmlParamters, true, recipients.UserId, true);
# }
#}
ENDSOURCE
SOURCE #txtNotExist
#public static TxtNotExist txtNotExist()
#{
# return "@LOQ137";
#}
ENDSOURCE
SOURCE #updateRuleIdLink
#public static void updateRuleIdLink(EventRuleId _oldRuleId
# , EventRuleId _newRuleId)
#{
# NVMPEventRuleRecipients recipients;
# ;
#
# ttsBegin;
#
# update_recordset recipients
# setting EventRuleId = _newRuleId
# where recipients.EventRuleId == _oldRuleId;
#
# ttsCommit;
#}
ENDSOURCE
ENDMETHODS
ENDTABLE
***Element: CLS
; Microsoft Dynamics AX Class: EventActionEmail unloaded
; --------------------------------------------------------------------------------
CLSVERSION 1
CLASS #EventActionEmail
PROPERTIES
Name #EventActionEmail
Extends #EventAction
RunOn #Called from
ENDPROPERTIES
METHODS
Version: 3
SOURCE #classDeclaration
#// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
#class EventActionEmail extends EventAction
#{
#
#}
ENDSOURCE
SOURCE #createEmailParameterMap
#Map createEmailParameterMap(EventInbox _inbox, EventType _eventType, EventRule _eventRule)
#{
# Map parameterMap = new Map(Types::String,Types::String);
# SqlSystem sqlSystem = new SqlSystem();
#
# SysDictClass dictClass = new SysDictClass(_inbox.TypeId);
# SysDictTable dictTable = new SysDictTable(_inbox.AlertTableId);
#
# SysDictField dictField = new SysDictField(_inbox.AlertTableId,_inbox.AlertFieldId);
# SysDictEnum dictEnum;
#
# str event;
# str table;
# str data;
#
# str previousValue;
# str currentValue;
#
# str drillDownGroup;
# ;
#
# event = EventInbox::buildSubject(_inbox);
#
# table = dictTable.label();
#
# if(SysDictClass::isEqualOrSuperclass(_inbox.TypeId, classnum(EventTypeCUD))&& _inbox.TypeTrigger == EventTypeTrigger::FieldChanged)
# {
# if (dictField.enumId() == 0)
# {
# previousValue = strfmt('%1',_eventType.parmOriginalValue());
# currentValue = strfmt('%1',_eventType.parmCurrentValue());
# }
# else
# {
# dictEnum = new SysDictEnum(dictField.enumId());
# previousValue = dictEnum.value2Label(_eventType.parmOriginalValue());
# currentValue = dictEnum.value2Label(_eventType.parmCurrentValue());
# }
#
# parameterMap.insert('beforevalue',previousvalue);
# parameterMap.insert('aftervalue',currentValue);
#
# data = strfmt('%1: %2; %3: %4', '@SYS69521',previousVAlue,'@SYS91541',currentValue);
#
# }
#
# drillDownGroup = EventDrillDownPoller::currentDrillDownNavigationMark();
#
# parameterMap.insert('occurred',datetime2str(_inbox.AlertCreatedDateTime, DateFlags::FormatAll));
# parameterMap.insert('for',_inbox.AlertedFor);
# parameterMap.insert('company',_inbox.CompanyId);
# parameterMap.insert('data',data);
# parameterMap.insert('subject',_inbox.Subject);
# parameterMap.insert('message',_inbox.Message);
# parameterMap.insert('LinkToBusinessData', drillDownGroup + '?DrillDown_' + int642str(_inbox.InboxId));
# parameterMap.insert('LinkToAlertRule', drillDownGroup + '?ViewAlertRule_' + int642str(_inbox.InboxId));
# parameterMap.insert('LinkToAlert', drillDownGroup + '?ViewAlert_' + int642str(_inbox.InboxId));
#
# parameterMap.insert('event', event);
# parameterMap.insert('alertid',_inbox.InboxId);
#
# return parameterMap;
#}
ENDSOURCE
SOURCE #execute
#public void execute(
# EventRule eventRule,
# EventType eventType,
# Common buffer,
# EventInbox alertInbox,
# // note: for due date events, the time and date on which the alert
# // is considered to be created is when the due date batch
# // started to run
# EventAlertCreatedDateTime alertCreatedDateTime = DateTimeUtil::newDateTime(systemdateget(),timenow(),DateTimeUtil::getUserPreferredTimeZone())
# )
#{
#
# SysUserInfo sysUserInfo;
# UserInfo userInfo;
#
# Map mappings;
#
# str xmlParameters;
#
# EventParameters eventParameters = EventParameters::find();
#
# ;
#
# // SysUserInfo has Alert and email info
# sysUserInfo = SysUserInfo::find(eventRule.UserId);
#
# // UserInfo has the language info
# userInfo = xUserInfo::find(false, eventRule.UserId);
#
# if (alertInbox
# &&
# (eventRule.AlertTableId != tablenum(SysOutgoingEmailTable))
# &&
# (eventRule.AlertTableId != tablenum(SysOutgoingEmailData))
# &&
# SysEmailDistributor::validateEmail(sysUserInfo.Email)
# &&
# ((sysUserInfo.EventEmailAlertsWhen == EventEmailSendDefineMode::AllRules) ||
# ((sysUserInfo.EventEmailAlertsWhen == EventEmailSendDefineMode::DefinedOnRule) &&
# (eventRule.SendEmail == true))
# )
# )
# {
# //NOTE: nothing is commited in SysOutgoingEmial table until the successful
#
# mappings = this.createEmailParameterMap(alertInbox,eventType,eventRule);
#
# xmlParameters = EventActionEmail::createEmailParameterXml(mappings);
#
# if (eventParameters.AlertTemplateId)
# {
# SysEmailTable::sendMail(eventParameters.AlertTemplateId,userInfo.Language,sysUserInfo.Email,mappings,'',xmlParameters,true,eventRule.UserId,true);
#
# // KeSae : 21/04/2010 : Alerting multiple mail recipients
# NVMPEventRuleRecipients::sendMail(eventRule.RuleId, eventParameters.AlertTemplateId, mappings, xmlParameters);
# }
# else
# throw error("@SYS94918");
# }
#
#}
ENDSOURCE
SOURCE #createEmailParameterXml
#static str createEmailParameterXml(Map parameterMap)
#{
# MapEnumerator enum = parameterMap.getEnumerator();
#
# XmlElement alert;
# XmlElement node;
# XmlCDataSection value;
# XmlDocument doc = new XmlDocument();
#
# ;
# alert = doc.createNode(XmlNodeType::Element,'alert','');
#
# while (enum.moveNext())
# {
#
# node = doc.createNode(XmlNodeType::Element,enum.currentKey(),'');
#
# //closing tag for CDATA section is illegal
# if (!strfind(enum.currentValue(),']]>',1,strlen(enum.currentValue())))
# value = doc.createCDataSection(enum.currentValue());
# else
# value = doc.createCDataSection('');
#
# node.appendChild(value);
# alert.appendChild(node);
#
# }
#
#
# doc.appendChild(alert);
#
# //Axapta uses UTF-16 encoding
# return '' + doc.xml();
#}
ENDSOURCE
ENDMETHODS
ENDCLASS
***Element: CLS
; Microsoft Dynamics AX Class: EventCreateRule unloaded
; --------------------------------------------------------------------------------
CLSVERSION 1
CLASS #EventCreateRule
PROPERTIES
Name #EventCreateRule
Extends #RunBase
RunOn #Called from
ENDPROPERTIES
METHODS
Version: 3
SOURCE #alertFieldChange
#TmpEventAlertField alertFieldChange(
# EventFieldLabelRich _alertFieldLabel
# )
#{
# ;
# tmpEventAlertField = this.eventBuildValidAlertFields().label2TmpEventAlertField(_alertFieldLabel);
# return tmpEventAlertField;
#}
ENDSOURCE
SOURCE #canCreateRule
#///
#/// Determines whether a rule can be created.
#///
#///
#/// true if a rule can be created; otherwise, false.
#///
#///
#/// The evaluation is based on the EventCreateRule.setValidCallerData method.
#///
#public boolean canCreateRule()
#{
# ;
# checkMode = true;
# return this.setValidCallerData();
#}
ENDSOURCE
SOURCE #checkAlertField
#///
#/// Tests whether the text entered in the Alert Field control is valid, by trying to find a corresponding record in the TmpEventAlertField temporary table.
#///
#///
#/// Text in the FormControl that hosts the Alert Field.
#///
#///
#/// true if the text entered in the Alert Field control is valid; otherwise, false.
#///
#///
#/// Used by the EventCreateRule form to test the validity of the text entered in the Alert Field control.
#///
#public boolean checkAlertField(
# EventFieldLabelRich _alertFieldLabel
# )
#{
# TmpEventAlertField tmpEventAlertFieldCheck = this.eventBuildValidAlertFields().label2TmpEventAlertField(_alertFieldLabel);
# ;
# return tmpEventAlertFieldCheck.RecId || !_alertFieldLabel ? true : checkFailed(strfmt("@SYS87769",_alertFieldLabel));
#}
ENDSOURCE
SOURCE #checkForeignKey
#///
#/// Tests whether the field specified in the rule is a foreign key. Creates a click-once message to the user describing what to do if the user wants to be alerted when the foreign key is changed.
#///
#///
#/// true if the field specified in the rule is a foreign key; otherwise, false.
#///
#///
#/// Used by the EventCreateRule form.
#///
#public boolean checkForeignKey()
#{
# xRefTableRelation xRefTableRelation;
# str fieldLabel;
#
# select firstonly xRefTableRelation;
#
# if (! xRefTableRelation)
# new xRefTableRelationUpdate().run();
#
# if (eventRuleTmp.AlertFieldId != 0)
# {
# while select xRefTableRelation
# where xRefTableRelation.RelationName == fieldid2name(eventRuleTmp.AlertTableId, eventRuleTmp.AlertFieldId)
# && xRefTableRelation.TableName == tableid2name(eventRuleTmp.AlertTableId)
# && xRefTableRelation.RelatedTableName != tableid2name(eventRuleTmp.AlertTableId)
#
# if (xRefTableRelation)
# {
# fieldLabel = new DictField(eventRuleTmp.AlertTableId, eventRuleTmp.AlertFieldId).label();
# Box::infoOnce( "@SYS94862",
# strfmt("@SYS94863", fieldLabel) + '\n\n' +
# strfmt("@SYS94864", fieldLabel),
# formstr(EventCreateRule));
# return true;
# }
# }
#
# return false;
#}
ENDSOURCE
SOURCE #classDeclaration
#///
#/// The EventCreateRule class is a standard RunBase inheritance that is used for creating rules.
#///
#///
#/// The Prompt part holds the UI for creating the rule (Form: EventCreateRule) and the Run part inserts the rule into the database.
#/// The class must be called with a FormRun. Before
#/// launching the UI in the prompt method, this class will collect all valid controls from the caller FormRun. This is done by utilizing the class EventBuildValidAlertFields.
#///
#// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
#class EventCreateRule extends RunBase
#{
# FormRun callerFormRun; // run-time instance of the caller form
# Args callerArgs; // args instance from the caller form (must be kept in separate variable for the sake that the caller form is closed before the rule is being created)
# tableId callerTableId; // Table id for the caller record
# fieldId callerFieldId; // If for the selected field in the caller form
# QueryRun queryRun; // QueryRun based on Query
# Query callerQuery; // The caller query
# FormDataSource callerFormDataSource; // The datasource hosting the selected field in the caller form
# Dialog dialog; // handle to the the Create Rule Ui
# EventRule eventRuleTmp; // temporary table hosting the record for the Create Rule Ui
# EventBuildValidAlertFields eventBuildValidAlertFields; // Handle to instance holding a temporary table with valid alert fields
# List formDataSourceList; // List of formDataSources in dataset
# boolean reBuildQuery; // flag to indicate that the query is dirty and needs to be rebuilt
# Object selectedControl; // current selected control in the caller form
# Map fds2EventBuildValidAlertFields; // Map holding valid alert field instances per formDataSource
# boolean checkMode; // Mode used for checking whether a rule can be created
# Common callerRecord; // The caller record. This has to be kept in separate variable, so that it will not change if cursor position changes in the caller form
# Common dynaLinkRecord; // The caller records dyna link record
# TmpEventAlertField tmpEventAlertField; // Instance representing selected field
# container packedEventType; // EventType hierarchy
# boolean expandHowOftenControl; // Must collapsable FormGroupControls be shown collapsed or expanded
# boolean expandWithControl; // Must collapsable FormGroupControls be shown collapsed or expanded
# boolean expandWhoControl; // Must collapsable FormGroupControls be shown collapsed or expanded
# boolean expandByControl; // Must collapsable FormGroupControls be shown collapsed or expanded
# EventRuleId createdRuleId; // RuleId for the created rule in Db
# FormRun eventRuleFormRun; // Handle to the EventRule formRun
#
# #define.CurrentVersion(1)
# #localmacro.CurrentList
# expandHowOftenControl,
# expandWithControl,
# expandWhoControl,
# expandByControl
# #endmacro
#
#}
#
ENDSOURCE
SOURCE #control2DsId
#// This method is used to find the dataSourceId for a formControl
#// The method is 'parent-recursive'. This means that it will traverse
#// parent containers if control does not have the datasource property set
#protected Integer control2DsId(
# Object _formControl
# )
#{
# Integer findDsId(boolean _controlHasDaProperty = true)
# {
# if (_controlHasDaProperty && _formControl.dataSource())
# return _formControl.dataSource();
# else if (_formControl.containerId())
# return this.control2DsId(callerFormRun.design().control(_formControl.containerId()));
# return 0;
# }
# ;
# if (!_formControl)
# return 0;
#
# switch (_formControl.handle())
# {
# case (classnum(FormButtonGroupControl)) :
# case (classnum(FormCheckBoxControl)) :
# case (classnum(FormComboBoxControl)) :
# case (classnum(FormDateControl)) :
# case (classnum(FormFunctionButtonControl)) :
# case (classnum(FormGridControl)) :
# case (classnum(FormGroupControl)) :
# case (classnum(FormIntControl)) :
# case (classnum(FormInt64Control)) :
# case (classnum(FormListBoxControl)) :
# case (classnum(FormRadioControl)) :
# case (classnum(FormRealControl)) :
# case (classnum(FormStaticTextControl)) :
# case (classnum(FormStringControl)) :
# case (classnum(FormTabControl)) :
# case (classnum(FormTabPageControl)) :
# case (classnum(FormTimeControl)) :
# case (classnum(FormWindowControl)) :
# case (classnum(FormDateTimeControl)) :
# return findDsId();
# default :
# return findDsId(false);
# }
# return 0;
#}
ENDSOURCE
SOURCE #cursorHasRecord
#// Since the A4A system supports aggregated fields (pseudo cursors) it is not enough to test for a recId in the caller record.
#// For pseudo cursors all records in the dataset (several in join scenarios) must be compared anainst an empty record of the same type.
#// If just one of the records in the pseudo cursor is different from an empty record, the cursor is passing this test.
#public boolean cursorHasRecord()
#{
# Common buffer,empty;
# MapEnumerator me;
# ;
# if (!this.isPseudoCursor())
# return this.parmCallerRecord().RecId ? true : false;
#
# me = this.eventBuildValidAlertFields(callerFormDataSource).formDataSourceMap().getEnumerator();
#
# while (me.moveNext())
# {
# buffer = me.currentValue().cursor();
# empty = new SysDictTable(buffer.TableId).makeRecord();
# if (!bufCmp(buffer,empty))
# return true;
# }
# return false;
#}
ENDSOURCE
SOURCE #dialog
#public Object dialog()
#{
# ;
# if (!dialog)
# dialog = super(Dialog::newFormnameRunbase(formstr(EventCreateRule),this));
# return dialog;
#}
#
ENDSOURCE
SOURCE #eventBuildValidAlertFields
#///
#/// Returns an instance of the EventBuildValidAlertFields class that corresponds to the specified FormDataSource. The instance of this class for a specific FormDataSource is only
#/// instantiated one time and is afterward kept in a Map.
#///
#///
#/// The FormDataSource for which a corresponding EventBuildValidAlertFields instance is requested.
#///
#///
#/// An instance of the EventBuildValidAlertFields class.
#///
#///
#/// For performance reasons, the fds2EventBuildValidAlertFields map is used.
#///
#public EventBuildValidAlertFields eventBuildValidAlertFields(
# FormDataSource _fds = callerFormDataSource
# )
#{
# if (!fds2EventBuildValidAlertFields)
# fds2EventBuildValidAlertFields = new Map(Types::Integer,Types::Class);
#
# if (!fds2EventBuildValidAlertFields.exists(_fds.id()))
# fds2EventBuildValidAlertFields.insert(_fds.id(),EventBuildValidAlertFields::newFormDataSource(callerFormRun,_fds,checkMode));
#
# return fds2EventBuildValidAlertFields.lookup(_fds.id());
#}
ENDSOURCE
SOURCE #fdsId2qbdsNo
#///
#/// Wraps the SysFormDataSource::fds2qbdsNo method. If the parameter is zero, then the ID of the callerFormDataSource is used.
#///
#///
#/// A unique run-time generated ID of a FormDataSource.
#///
#///
#/// The QueryBuildDataSource number in the query that hosts the FormDataSource.
#///
#public DataSourceNumber fdsId2qbdsNo(
# Integer _fdsId
# )
#{
# return SysFormDataSource::fds2qbdsNo(SysFormDataSource::fdsId2fds(callerFormRun,_fdsId ? _fdsId : callerFormDataSource.id()));
#}
ENDSOURCE
SOURCE #fieldsAreInUniqueIndex
#// This method will decide if fieldId's in the set are unique key fields for the table
#boolean fieldsAreInUniqueIndex(
# tableId _tableId,
# Set _fields
# )
#{
# SysDictTable dictTable = new SysDictTable(_tableId);
# DictIndex dictIndex = dictTable.firstUniqueIndex();
# Integer i;
# boolean tryNext;
# ;
# while (dictIndex)
# {
# tryNext = false;
# for (i=1;i<=dictIndex.numberOfFields();i++)
# {
# if (!_fields.in(dictIndex.field(i)))
# {
# dictIndex = dictTable.firstUniqueIndex(dictIndex.id());
# tryNext = true;
# break;
# }
# }
# if (!tryNext)
# return true;
# }
# return false;
#}
ENDSOURCE
SOURCE #findValidCallerDS
#// This method will find a valid caller datasource based on priority:
#// 1: If the selected control is a valid alert field, then the associated datasource will be returned
#// 2: If the control (or any of its parents) has a datasource in the datasource property, then this datasource will be returned
#// 3: First datasource containing valid alert fields will be returned
#protected FormDataSource findValidCallerDS()
#{
# FormDataSource fds;
# Integer h;
# container invalidDSCon;
# ;
# // Priority 1: if selected control is a field on a datasource with valid alert fields, then this will be returned
# if (EventBuildValidAlertFields::isControlTypeValid(selectedControl) && selectedControl.dataSource())
# {
# fds = SysFormDataSource::fdsId2fds(callerFormRun,selectedControl.dataSource());
# if (fds && fds.queryRun() && this.eventBuildValidAlertFields(fds).parmTmpEventAlertField().RecId)
# return fds;
# else if (fds)
# invalidDSCon += fds.id();
# }
# // Priority 2: if selected control (or parents to this) has an associated datasource
# fds = SysFormDataSource::fdsId2fds(callerFormRun,this.control2DsId(selectedControl));
# if (fds && fds.queryRun() && !confind(invalidDSCon,fds.id()))
# if (this.eventBuildValidAlertFields(fds).parmTmpEventAlertField().RecId)
# return fds;
# else
# invalidDSCon += fds.id();
#
# // Priority 3: find first datasource holding valid alert fields
# for (h=1;h<=callerFormRun.form().dataSourceCount();h++)
# {
# fds = callerFormRun.dataSource(h);
# if (fds.queryRun() && !confind(invalidDSCon,fds.id()))
# if (this.eventBuildValidAlertFields(fds).parmTmpEventAlertField().RecId)
# return fds;
# }
# return null;
#}
ENDSOURCE
SOURCE #formDataSourceList
#protected List formDataSourceList()
#{
# FormDataSource joinChild,joinParent;
# ;
# if (!formDataSourceList)
# {
# formDataSourceList = new List(Types::Class);
# joinChild = callerFormDataSource;
# joinParent = formGetParentDatasource(joinChild);
#
# formDataSourceList.addStart(joinChild);
#
# while (joinParent && SysFormDataSource::fdsIsJoined(joinChild))
# {
# formDataSourceList.addStart(joinParent);
# joinChild = joinParent;
# joinParent = formGetParentDatasource(joinChild);
# }
# }
# return formDataSourceList;
#}
ENDSOURCE
SOURCE #getFromDialog
#public boolean getFromDialog()
#{
# boolean ret;
# Object object;
# ;
# select firstonly eventRuleTmp;
#
# ret = super();
# object = dialog.formRun();
# object = object.eventRuleFormHandler();
# packedEventType = object.packEventType(eventRuleTmp);
#
# return ret;
#}
ENDSOURCE
SOURCE #initEventRule
#protected boolean initEventRule()
#{
#
# List actions = new List(Types::Integer);
#
# actions.addEnd(classnum(EventActionAlert));
# actions.addEnd(classnum(EventActionEmail));
#
#
# ttsbegin;
#
# //BP Deviation Documented
# eventRuleTmp.setTmp();
# eventRuleTmp.checkRecord(false);
#
# eventRuleTmp.Enabled = NoYes::Yes;
# eventRuleTmp.UserId = curuserid();
# eventRuleTmp.ActionIds = actions.pack();
#
# eventRuleTmp.PrimTableId = this.parentDataSource().cursor().TableId;
# eventRuleTmp.AlertFieldId = callerFieldId;
# eventRuleTmp.AlertTableId = callerTableId ? callerTableId : eventRuleTmp.PrimTableId;
# eventRuleTmp.AlertQbdsNo = this.fdsId2qbdsNo(callerFormDataSource.id());
# eventRuleTmp.FormName = callerFormRun.name();
# eventRuleTmp.IsAggregated = this.isPseudoCursor();
#
# eventRuleTmp.insert();
#
# ttscommit;
#
# return true;
#}
ENDSOURCE
SOURCE #initParameters
#protected boolean initParameters()
#{
# ;
# if (!this.setValidCallerData())
# return false;
#
# if (!this.initEventRule())
# return false;
#
# reBuildQuery = true;
#
# return true;
#}
ENDSOURCE
SOURCE #initParmDefault
#public void initParmDefault()
#{
# super();
#
# expandHowOftenControl = false;
# expandWithControl = true;
#}
ENDSOURCE
SOURCE #isPseudoCursor
#public boolean isPseudoCursor()
#{
# return this.eventBuildValidAlertFields().isPseudoCursor();
#}
ENDSOURCE
SOURCE #lockUserIdRange
#void lockUserIdRange(Query _query)
#{
# QueryBuildDataSource qbd;
# Integer i;
# Integer h;
# ;
# for (i=1;i<=_query.dataSourceCount();i++)
# {
# qbd = _query.dataSourceNo(i);
#
# if (qbd.table() ==tablenum(EventRule))
# {
#
# for (h=1;h<=qbd.rangeCount();h++)
# {
# if (qbd.range(h).name() == 'UserId')
# {
# qbd.range(h).status(RangeStatus::Locked);
# }
# }
#
# }
# }
#}
ENDSOURCE
SOURCE #nonFieldRelatedTmpEventAlertField
#TmpEventAlertField nonFieldRelatedTmpEventAlertField()
#{
# ;
# tmpEventAlertField = this.eventBuildValidAlertFields().nonFieldRelatedTmpEventAlertField();
# return tmpEventAlertField;
#}
ENDSOURCE
SOURCE #pack
#public container pack()
#{
# return [#CurrentVersion,#CurrentList];
#}
ENDSOURCE
SOURCE #packContextInfo
#protected container packContextInfo(
# EventRule _eventRule
# )
#{
# FormDataSource fds;
# EventContextInformation eci = new EventContextInformation();
# List l = this.formDataSourceList();
# ListEnumerator le;
# FormControl fieldControl;
# if (l && l.elements())
# {
# le = l.getEnumerator();
# le.moveNext();
# fds = le.current();
# }
# fieldControl = tmpEventAlertField.ControlId ? callerFormRun.control(tmpEventAlertField.ControlId) : null;
#
# eci.setEventRuleId(_eventRule.RuleId);
# eci.parmFormRun(callerFormRun);
# eci.parmPackedArgs(callerArgs);
# eci.parmAlertFormDsName(fds ? fds.name() : '');
# eci.parmFormControlName(fieldControl ? fieldControl.name() : '');
# return eci.pack();
#}
ENDSOURCE
SOURCE #parentDataSource
#protected FormDataSource parentDataSource()
#{
# ListEnumerator le = this.formDataSourceList().getEnumerator();
# ;
# le.moveNext(); // parent datasource is first in list
# return le.current();
#}
ENDSOURCE
SOURCE #parmCallerFormDataSource
#public FormDataSource parmCallerFormDataSource(
# FormDataSource _callerFormDataSource = callerFormDataSource
# )
#{
# ;
# callerFormDataSource = _callerFormDataSource;
# return callerFormDataSource;
#}
#
ENDSOURCE
SOURCE #parmCallerFormRun
#public FormRun parmCallerFormRun(
# FormRun _callerFormRun = callerFormRun
# )
#{
# ;
# callerFormRun = _callerFormRun;
# return callerFormRun;
#}
#
ENDSOURCE
SOURCE #parmCallerRecord
#public Common parmCallerRecord(
# Common _callerRecord = callerRecord
# )
#{
# ;
# callerRecord = _callerRecord;
# return callerRecord;
#}
#
ENDSOURCE
SOURCE #parmCreatedRuleId
#public EventRuleId parmCreatedRuleId(
# EventRuleId _createdRuleId = createdRuleId
# )
#{
# ;
# createdRuleId = _createdRuleId;
# return createdRuleId;
#}
#
ENDSOURCE
SOURCE #parmDynaLinkRecord
#public Common parmDynaLinkRecord(
# Common _dynaLinkRecord = dynaLinkRecord
# )
#{
# ;
# dynaLinkRecord = _dynaLinkRecord;
# return dynaLinkRecord;
#}
#
ENDSOURCE
SOURCE #parmEventRuleFormRun
#public FormRun parmEventRuleFormRun(
# FormRun _eventRuleFormRun = eventRuleFormRun
# )
#{
# ;
# eventRuleFormRun = _eventRuleFormRun;
# return eventRuleFormRun;
#}
#
ENDSOURCE
SOURCE #parmEventRuleTmp
#public EventRule parmEventRuleTmp(
# EventRule _eventRuleTmp = eventRuleTmp
# )
#{
# ;
# eventRuleTmp = _eventRuleTmp;
# return eventRuleTmp;
#}
#
ENDSOURCE
SOURCE #parmExpandByControl
#public boolean parmExpandByControl(
# boolean _expandByControl = expandByControl
# )
#{
# ;
# expandByControl = _expandByControl;
# return expandByControl;
#}
ENDSOURCE
SOURCE #parmExpandHowOftenControl
#public boolean parmExpandHowOftenControl(
# boolean _expandHowOftenControl = expandHowOftenControl
# )
#{
# ;
# expandHowOftenControl = _expandHowOftenControl;
# return expandHowOftenControl;
#}
#
ENDSOURCE
SOURCE #parmExpandWhoControl
#public boolean parmExpandWhoControl(
# boolean _expandWhoControl = expandWhoControl
# )
#{
# ;
# expandWhoControl = _expandWhoControl;
# return expandWhoControl;
#}
#
ENDSOURCE
SOURCE #parmExpandWithControl
#public boolean parmExpandWithControl(
# boolean _expandWithControl = expandWithControl
# )
#{
# ;
# expandWithControl = _expandWithControl;
# return expandWithControl;
#}
#
ENDSOURCE
SOURCE #parmRebuildQuery
#public boolean parmRebuildQuery(
# boolean _rebuildQuery = rebuildQuery
# )
#{
# ;
# rebuildQuery = _rebuildQuery;
# return rebuildQuery;
#}
#
ENDSOURCE
SOURCE #parmTmpEventAlertField
#public TmpEventAlertField parmTmpEventAlertField(
# TmpEventAlertField _tmpEventAlertField = tmpEventAlertField
# )
#{
# ;
# tmpEventAlertField = _tmpEventAlertField;
# return tmpEventAlertField;
#}
#
ENDSOURCE
SOURCE #prompt
#public boolean prompt()
#{
# startLengthyOperation();
#
# if (!this.initParameters())
# return false;
# return super();
#}
ENDSOURCE
SOURCE #queryAddDynaCursor
#///
#/// Traverses the query of the callerFormDataSource, and for each dynaLink appends the corresponding field and dyna value to the specified query.
#///
#///
#/// Dyna fields and values are added ranges and values to this query.
#///
#protected void queryAddDynaCursor(
# Query _query
# )
#{
# QueryBuildDataSource qbdCur;
# QueryBuildDataSource qbdDyna;
# QueryBuildDynalink qbDyna;
# Counter dynaLinkNo;
# Integer queryDsNO;
# Query queryDyna;
# Set dynaFields;
# Common dynaRecord;
# Map keyFields;
# ;
# queryDyna = callerFormDataSource.queryRun().query(); // query having external links (=dyna links)
# queryDsNO = SysFormDataSource::fds2qbdsNo(this.parentDataSource()); // queryBuildDataSource on _queryDyna having external links
#
# if (!_query || !queryDyna || !queryDsNO || !queryDyna.dataSourceNo(queryDsNO))
# return;
#
# dynaFields = new Set(Types::Integer);
#
# // Build list of dyna-fields
# for (dynaLinkNo=1;dynaLinkNo<=queryDyna.dataSourceNo(queryDsNO).dynalinkCount();dynaLinkNo++)
# {
# qbDyna = queryDyna.dataSourceNo(queryDsNO).dynalink(dynaLinkNo);
# dynaFields.add(qbDyna.dynamicField());
# }
# if (dynaFields.elements() && this.fieldsAreInUniqueIndex(qbDyna.cursor().TableId,dynaFields))
# {
# // Add unique id fields from caller records dynalink record as ranges+values
# SysQuery::queryAddDynaCursorAsRangeAndValue(_query,callerFormDataSource.queryRun().query(),SysFormDataSource::fds2qbdsNo(this.parentDataSource()));
# }
# else if (dynaFields.elements())
# {
# // Dyna cursor is being inner-joined based on dyna-fields and ranged down to the unique record
# dynaRecord = queryDyna.dataSourceNo(queryDsNO).dynalink(1).cursor();
# qbdCur = _query.dataSourceName(queryDyna.dataSourceNo(queryDsNO).name());
# if (qbdCur)
# {
# qbdDyna = qbdCur.addDataSource(dynaRecord.TableId);
# qbdDyna.joinMode(JoinMode::ExistsJoin);
# qbdDyna.clearLinks();
# keyFields = SysDictTable::mapFieldIds2Values(SysDictTable::getUniqueIndexFields(dynaRecord.TableId),dynaRecord);
# SysQuery::addRangesFromKeyData(qbdDyna,keyFields.pack());
# }
# }
#}
ENDSOURCE
SOURCE #queryAddUniqueRangeAndValue
#protected void queryAddUniqueRangeAndValue(Query _query)
#{
# Integer i,l;
# QueryBuildDataSource qbdS;
# MapEnumerator me;
# FormDataSource fds;
# QueryBuildRange qbr;
# ;
# if (!this.isPseudoCursor())
# {
# SysQuery::queryAddUniqueRangeAndValue(_query,callerRecord);
# return;
# }
#
# // For a pseudo cursor: add the value of each 'group by field' as range in the query
# for (i=1;i<=_query.dataSourceCount();i++)
# {
# qbdS = _query.dataSourceNo(i);
#
# if (qbdS && qbdS.orderMode() == OrderMode::GroupBy)
# {
# fds = null;
# me = this.eventBuildValidAlertFields().formDataSourceMap().getEnumerator();
#
# // find the formDataSource that corresponds to the queryBuildDataSource
# while (me.moveNext())
# if (SysFormDataSource::fds2qbdsNo(me.currentValue()) == qbdS.id())
# fds = me.currentValue();
#
# if (fds)
# {
# for (l=1;l<=qbdS.sortFieldCount();l++)
# {
# if (fds.cursor().(qbdS.sortField(l))) // only 'group by fields' holding a value will be added
# {
# qbr = SysQuery::findOrCreateRange(qbdS,qbdS.sortField(l));
# qbr.value(queryValue(fds.cursor().(qbdS.sortField(l))));
# }
# }
# }
# }
# }
#}
ENDSOURCE
SOURCE #queryrun
#// This method will return a QueryRun that is manipulated so that it reflects current "Rule Condition"
#QueryRun queryrun()
#{
# EventRule eventRuleTest;
# Query newQuery;
# ;
# if (!rebuildQuery)
# return queryRun;
#
# //BP Deviation Documented
# eventRuleTest.setTmp();
# eventRuleTest.setTmpData(eventRuleTmp);
#
# select firstonly eventRuleTest;
#
# if (eventRuleTest.RuleCondition == EventRuleCondition::Current)
# {
# newQuery = new Query(callerFormDataSource.queryRun().query().pack(false));
# this.queryAddUniqueRangeAndValue(newQuery);
# }
# else
# {
# if (eventRuleTest.TypeId && !EventType::construct(eventRuleTest.TypeId,eventRuleTest.TypeTrigger).isFilterInteractive())
# {
# newQuery = new Query();
# newQuery.addDataSource(eventRuleTest.AlertTableId ? eventRuleTest.AlertTableId : eventRuleTest.PrimTableId);
# }
# else
# {
# newQuery = new Query(callerFormDataSource.queryRun().query().pack(false));
# this.queryAddDynaCursor(newQuery);
# if (eventRuleTest.RuleCondition == EventRuleCondition::Custom)
# this.setAllRanges2Open(newQuery);
# }
# }
#
# this.lockUserIdRange(newQuery);
#
# rebuildQuery = false;
# queryRun = new QueryRun(newQuery);
# return queryRun;
#}
ENDSOURCE
SOURCE #run
#///
#/// Inserts a new rule into the database.
#///
#///
#/// Records are inserted in the following tables:
#///
#///
#/// -
#/// EventRuleData
#///
#///
#/// -
#/// EventRuleRel
#///
#///
#/// -
#/// EventRuleRelData
#///
#///
#/// -
#/// EventRuleField
#///
#///
#///
#///
#public void run()
#{
# #OCCRetryCount
# EventRule eventRuleDB;
#
# // KeSae : 21/04/2010 : Alerting multiple mail recipients
# EventRuleId oldRuleId;
# ;
#
# try
# {
# ttsbegin;
#
# select firstonly eventRuleTmp;
#
# eventRuleDB.data(eventRuleTmp);
# eventRuleDB.setDeleteRefRecId(callerRecord);
#
# // KeSae : 21/04/2010 : Alerting multiple mail recipients
# oldRuleId = eventRuleDB.RuleId;
#
# eventRuleDB.RuleId = this.parmCreatedRuleId();
# eventRuleDB.insert();
# eventRuleDB.filterQuery(this.queryrun().query());
# eventRuleDB.alertField([tmpEventAlertField]);
# eventRuleDB.typeValue(packedEventType);
# eventRuleDB.contextInfo(this.packContextInfo(eventRuleDB));
#
# this.parmCreatedRuleId(eventRuleDB.RuleId);
#
# // KeSae : 21/04/2010 : Alerting multiple mail recipients
# // Since the RuleId changes during this process, update the link in the recipient table
# NVMPEventRuleRecipients::updateRuleIdLink(oldRuleId, eventRuleDB.RuleId);
#
# ttscommit;
#
# this.checkForeignKey();
# }
# catch (Exception::Deadlock)
# {
# retry;
# }
# catch (Exception::UpdateConflict)
# {
# if (appl.ttsLevel() == 0)
# {
# if (xSession::currentRetryCount() >= #RetryNum)
# {
# throw Exception::UpdateConflictNotRecovered;
# }
# else
# {
# retry;
# }
# }
# else
# {
# throw Exception::UpdateConflict;
# }
# }
#
#}
ENDSOURCE
SOURCE #setAllRanges2Open
#///
#/// Traverses all ranges on the specified query. All ranges that have the RangeStatus set to Hidden or Locked will be changed to have the RangeStatus set to Open.
#///
#///
#/// A query with ranges.
#///
#void setAllRanges2Open(Query _query)
#{
# QueryBuildDataSource qbd;
# Integer i;
# Integer h;
# ;
# for (i=1;i<=_query.dataSourceCount();i++)
# {
# qbd = _query.dataSourceNo(i);
# for (h=1;h<=qbd.rangeCount();h++)
# if (qbd.range(h).status() == RangeStatus::Hidden || qbd.range(h).status() == RangeStatus::Locked)
# qbd.range(h).status(RangeStatus::Open);
# }
#}
ENDSOURCE
SOURCE #setValidCallerData
#// This method is used to set all initialization from caller
#// Everything must be stored in separate variables, i.e. it can not be addressed via
#// references as the active caller record may change during Create Rule scenario or the form may be closed!!
#protected boolean setValidCallerData()
#{
# ;
# callerArgs = callerFormRun.args();
# selectedControl = callerFormRun.selectedControl();
#
# if (!selectedControl)
# return false;
#
# if (!callerFormRun.form().dataSourceCount())
# return false;
#
# callerFormDataSource = this.findValidCallerDS();
#
# if (!callerFormDataSource)
# return false;
#
# callerRecord = this.parentDataSource().cursor();
# dynaLinkRecord = SysFormDataSource::fds2DynaLinkRecord(this.parentDataSource());
#
# if (selectedControl)
# {
# // first attempt: find the tmpEventAlertField record that corresponds to the ID of the selected control
# tmpEventAlertField = this.eventBuildValidAlertFields(callerFormDataSource).controlId2TmpEventAlertField(selectedControl.id());
# // second attempt: find the tmpEventAlertField record that corresponds to the label of the selected control
# tmpEventAlertField = tmpEventAlertField ? tmpEventAlertField : this.eventBuildValidAlertFields(callerFormDataSource).label2TmpEventAlertField(selectedControl.labelText());
# }
# // third attempt: find the tmpEventAlertField record that corresponds to the '' entry
# tmpEventAlertField = tmpEventAlertField ? tmpEventAlertField : this.eventBuildValidAlertFields(callerFormDataSource).entireTable2TmpEventAlertField();
# // foruth attempt: find the first tmpEventAlertField record in alphabetical order
# tmpEventAlertField = tmpEventAlertField ? tmpEventAlertField : this.eventBuildValidAlertFields(callerFormDataSource).first2TmpEventAlertField();
#
# if (!tmpEventAlertField)
# return false;
#
# callerQuery = callerFormDataSource.queryRun().query();
# callerFieldId = fieldExt2Id(tmpEventAlertField.RefFieldId);
# callerTableId = callerFormDataSource.cursor().TableId;
#
# return true;
#}
ENDSOURCE
SOURCE #showIndexFields
#public boolean showIndexFields(tableId id)
#{
# return false;
#}
ENDSOURCE
SOURCE #showQueryValues
#public boolean showQueryValues()
#{
# return true;
#}
ENDSOURCE
SOURCE #unpack
#public boolean unpack(container packedClass)
#{
# Version version = RunBase::getVersion(packedClass);
#;
# switch (version)
# {
# case #CurrentVersion:
# [version,#CurrentList] = packedClass;
# break;
# default:
# return false;
# }
#
# return true;
#}
ENDSOURCE
SOURCE #construct
#///
#/// Constructs an instance of the class.
#///
#///
#/// An instance of the EventCreateRule class.
#///
#///
#/// The instance is forced on the client tier in this method.
#///
#static client EventCreateRule construct()
#{
# return new EventCreateRule();
#}
ENDSOURCE
SOURCE #Main
#static void main(
# Args _args
# )
#{
# EventCreateRule eventCreateRule;
# Object eventRuleFormRun;
# ;
# if (_args && _args.caller() && _args.caller().name() == formstr(EventRule) && _args.caller().parmCreateRuleFormRun())
# {
# eventRuleFormRun = _args.caller();
# eventCreateRule = EventCreateRule::construct();
# eventCreateRule.parmEventRuleFormRun(eventRuleFormRun);
# eventCreateRule.parmCallerFormRun(eventRuleFormRun.parmCreateRuleFormRun());
# if (eventCreateRule.prompt())
# {
# eventCreateRule.run();
# eventRuleFormRun.doReselectFind(eventCreateRule.parmCreatedRuleId());
# }
# else
# {
# eventRuleFormRun.close();
# }
# }
#}
ENDSOURCE
SOURCE #newCheckFormRun
#///
#/// Determines whether a specified FormRun is valid for creating rules.
#///
#///
#/// The FormRun instance that is to be checked.
#///
#///
#/// true if the specified FormRun is valid for creating rules; otherwise, false.
#///
#///
#/// This method instantiates the class without calling the standard Prompt method or Run method.
#/// This method is typically used for UI purposes; for example, to decide whether to display
#/// the Create Alert Rule menu item in the right-click menu.
#///
#public static boolean newCheckFormRun(
# FormRun _formRun
# )
#{
# EventCreateRule eventCreateRule = EventCreateRule::construct();
# ;
# eventCreateRule.parmCallerFormRun(_formRun);
# return eventCreateRule.canCreateRule();
#}
ENDSOURCE
SOURCE #newFindMainTableLabelFormRun
#public static client TableLabel newFindMainTableLabelFormRun(
# FormRun _formRun
# )
#{
# TableLabel mainTableLabel;
# EventCreateRule eventCreateRule = EventCreateRule::construct();
# ;
# eventCreateRule.parmCallerFormRun(_formRun);
# if (eventCreateRule.canCreateRule() && eventCreateRule.parentDataSource())
# mainTableLabel = new SysDictTable(eventCreateRule.parentDataSource().table()).label();
# return mainTableLabel;
#}
ENDSOURCE
ENDMETHODS
ENDCLASS
***Element: FRM
; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5
FORM #EventCreateRule
PROPERTIES
Name #EventCreateRule
ENDPROPERTIES
METHODS
Version: 3
SOURCE #classDeclaration
#public class FormRun extends ObjectRun
#{
# EventCreateRule eventCreateRule;
# EventRuleFormHandler eventRuleFormHandler;
# NoYes adminMode;
#
# SysUserInfo userInfo;
#
# EventPopupShowDefineMode showPopUp;
# EventEmailSendDefineMode sendEmail;
#
#
# #Define.maxAlertMeForStr(100)
# #Define.numberOfDotsOnTruncate(4)
#}
ENDSOURCE
SOURCE #canClose
#public boolean canClose()
#{
# boolean ret;
# ;
# if (!element.closedOk())
# return true;
#
# ret = super();
#
# ret = ret && eventRule.checkFilterAccess(element.runBase().queryrun().query().pack());
#
# return ret;
#}
ENDSOURCE
SOURCE #close
#public void close()
#{
# element.runBase().parmExpandHowOftenControl(alertMeHowOften.expand());
# element.runBase().parmExpandWithControl(alertMeWith.expand());
# element.runBase().parmExpandWhoControl(alertWho.expand());
# element.runBase().parmExpandByControl(alertBy.expand());
#
# super();
#}
ENDSOURCE
SOURCE #initFormControls
#void initFormControls()
#{
#
# boolean canShowEmailCheckBox = (userInfo.EventEmailAlertsWhen == EventEmailSendDefineMode::DefinedOnRule) &&
# userInfo.Email &&
# SysEmailDistributor::validateEmail(userInfo.Email) &&
# (element.eventRuleFormHandler().parmPrimTableId() != tablenum(SysOutgoingEmailTable)) &&
# (element.eventRuleFormHandler().parmPrimTableId() != tablenum(SysOutgoingEmailData));
#
# boolean canShowPopUpCheckBox = userInfo.EventPopUpDisplayWhen == EventPopupShowDefineMode::DefinedOnRule;
#
# ;
#
# alertMeHowOften.expand(element.runBase().parmExpandHowOftenControl());
# if (!alertMeHowOften.expand())
# alertMeHowOften.clicked();
#
# alertMeWith.expand(element.runBase().parmExpandWithControl());
# if (!alertMeWith.expand())
# alertMeWith.clicked();
#
# alertWho.expand(element.runBase().parmExpandWhoControl());
# if (!alertWho.expand())
# alertWho.clicked();
#
# alertBy.expand(element.runBase().parmExpandByControl());
# if (!alertBy.expand())
# alertBy.clicked();
#
# if (!canShowPopUpCheckBox && !canShowEmailCheckBox)
# alertBy.visible(false); //make invisible the entire group
# else if (!canShowPopUpCheckBox)
# eventRule_ShowPopUp.visible(false);
# else if (!canShowEmailCheckBox)
# {
# eventRule_SendEmail.visible(false);
# eventRule_SendEmailAddress.visible(false);
# }
# else
# eventRule_SendEmailAddress.text(userInfo.Email);
#
#}
ENDSOURCE
SOURCE #truncateAlertMeForStr
#str 200 truncateAlertMeForStr(str 200 _inputStr)
#{
# str 200 outputStr;
# int i;
# ;
# if (strlen(_inputStr) < #maxAlertMeForStr)
# return _inputStr;
#
# outputStr = substr(_inputStr,1,#maxAlertMeForStr-#numberOfDotsOnTruncate);
#
# for (i=1;i<=#numberOfDotsOnTruncate;i++)
# outputStr += '.';
# return outputStr;
#}
ENDSOURCE
SOURCE #closeOk
#public void closeOk()
#{
# if (this.runBase().checkCloseDialog())
# super();
#}
#
ENDSOURCE
SOURCE #eventRuleFormHandler
#EventRuleFormHandler eventRuleFormHandler()
#{
# return eventRuleFormHandler;
#}
ENDSOURCE
SOURCE #initFromCaller
#void initFromCaller()
#{
# TmpEventAlertField tmpEventAlertField;
# ;
# if (!eventRule.RecId)
# return;
#
# tmpEventAlertField = element.runBase().parmTmpEventAlertField();
#
# eventRule.initFromTmpEventAlertField(tmpEventAlertField);
# eventRuleFormHandler.setEventType(eventRule,tmpEventAlertField);
#
# element.design().caption(strfmt("%1 - %2",element.design().caption(),eventRule.primTableLabel()));
#
#// eventRule_ds.setInfoTxt(eventRule);
#// eventRule_ds.setFilterButton(eventRule);
# eventRule_ds.initRuleCondition(eventRule);
#}
ENDSOURCE
SOURCE #run
#public void run()
#{
# element.lock();
# super();
# this.initFromCaller();
# element.initFormControls();
# element.unLock();
# element.arrange();
#}
ENDSOURCE
SOURCE #init
#public void init()
#{
#
# SysDictMenu sysDictMenu = SysDictMenu::newMenuItem(menuitemdisplaystr(EventRuleAdmin), MenuItemType::Display);
# ;
#
# adminMode = EventSecurity::construct(curuserid()).isUserAdmin() ? NoYes::Yes : NoYes::No;
# eventCreateRule = element.args().caller().runbase();
# super();
# eventRuleFormHandler = EventRuleFormHandler::newFormRun(element,x_string,x_integer,x_combo,x_date,x_real,x_time,x_int64,x_dateTime);
# eventRuleFormHandler.parmPrimTableId(element.runBase().parmEventRuleTmp().PrimTableId);
#
# userInfo = SysUserInfo::find(curuserid());
#
# showPopUp = userInfo.EventPopUpDisplayWhen;
# sendEmail = userInfo.EventEmailAlertsWhen;
#
# eventRule_ds.object(fieldnum(EventRule,UserId)).visible(adminMode && (sysDictMenu.rights() > AccessType::View));
# alertWho.visible(adminMode && (sysDictMenu.rights() > AccessType::View));
#
# eventRuleFormHandler.parmIsPseudoCursor(element.runBase().isPseudoCursor());
#}
ENDSOURCE
SOURCE #runBase
#EventCreateRule runBase()
#{
# return eventCreateRule;
#}
ENDSOURCE
ENDMETHODS
OBJECTBANK
PROPERTIES
ENDPROPERTIES
DATASOURCE
OBJECTPOOL
PROPERTIES
Name #EventRule
Table #EventRule
AllowCreate #No
AllowDelete #No
LinkType #Passive
InsertAtEnd #No
InsertIfEmpty #No
ENDPROPERTIES
FIELDLIST
DATAFIELD RuleCondition
PROPERTIES
ENDPROPERTIES
METHODS
Version: 3
SOURCE #validate
#public boolean validate()
#{
# boolean ret;
#
# ret = super();
#
# if (eventRule.RuleCondition == EventRuleCondition::Current && !element.runBase().parmCallerRecord().RecId)
# ret = false;
#
# if (ret && eventRule.RuleCondition == EventRuleCondition::Custom && !eventRule.isFilterInteractive())
# ret = false;
#
# if (ret && eventRule.RuleCondition == EventRuleCondition::Current && element.eventRuleFormHandler().parmTmpEventType().TypeId == classnum(EventTypeCUD) &&
# element.eventRuleFormHandler().parmTmpEventType().TypeTrigger == EventTypeTrigger::RecordInsert)
# ret = false;
#
# return ret;
#}
ENDSOURCE
SOURCE #modified
#public void modified()
#{
# super();
# eventRule_ds.write();
# element.runBase().parmRebuildQuery(true);
# eventRule_ds.setUntil(eventRule);
#}
ENDSOURCE
ENDMETHODS
ENDDATAFIELD
DATAFIELD Subject
PROPERTIES
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public void modified()
#{
# super();
# eventRuleFormHandler.parmSubjectAutoUpdate(eventRule.Subject ? false : true);
#}
ENDSOURCE
ENDMETHODS
ENDDATAFIELD
DATAFIELD Until
PROPERTIES
ENDPROPERTIES
METHODS
Version: 3
SOURCE #validate
#public boolean validate()
#{
# boolean ret;
#
# ret = super();
#
# if (eventRule.RuleCondition == EventRuleCondition::Current &&
# element.eventRuleFormHandler().parmTmpEventType().TypeId == classnum(EventTypeCUD) &&
# element.eventRuleFormHandler().parmTmpEventType().TypeTrigger == EventTypeTrigger::RecordDelete &&
# eventRule.Until == EventUntil::Always
# )
# {
# ret = false;
# }
# return ret;
#}
ENDSOURCE
SOURCE #modified
#public void modified()
#{
# super();
# eventRule.UntilDate = eventRule.Until == EventUntil::UntilDate ? today() : dateNull();
# eventRule_ds.object(fieldnum(EventRule,UntilDate)).allowEdit(eventRule.Until == EventUntil::UntilDate ? true : false);
# eventRule_ds.refresh();
#}
#
#
ENDSOURCE
ENDMETHODS
ENDDATAFIELD
DATAFIELD UntilDate
PROPERTIES
AllowEdit #No
ENDPROPERTIES
METHODS
Version: 3
SOURCE #validate
#public boolean validate()
#{
# boolean ret;
#
# ret = super();
#
# if (ret && eventRule.Until == EventUntil::UntilDate)
# ret = eventRule.UntilDate < today() || !eventRule.UntilDate ? checkFailed(strfmt("@SYS70843","@SYS22882")) : true;
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDDATAFIELD
DATAFIELD UserId
PROPERTIES
ENDPROPERTIES
METHODS
Version: 3
SOURCE #validate
#public boolean validate()
#{
# boolean ret;
#
# ret = super();
#
# startLengthyOperation();
#
# ret = ret && eventRule.checkFilterAccess(element.runBase().queryrun().query().pack());
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDDATAFIELD
ENDFIELDLIST
ENDOBJECTPOOL
METHODS
Version: 3
SOURCE #write
#public void write()
#{
# ;
#
# eventRule.ShowPopup = eventRule_ShowPopUp.checked();
# eventRule.SendEmail = eventRule_SendEmail.checked();
#
# super();
#}
ENDSOURCE
SOURCE #active
#public int active()
#{
# int ret;
# ;
#
# eventRule_ds.object(fieldnum(EventRule,UntilDate)).allowEdit(eventRule.Until == EventUntil::UntilDate ? true : false);
#
# ret = super();
#
# return ret;
#}
ENDSOURCE
SOURCE #initRuleCondition
#void initRuleCondition(
# EventRule _eventRule
# )
#{
# str 200 strAll;
# str 200 strCurrent;
# str 200 strCustom;
# SysDictTable curDictTable;
# SysDictTable callerDictTable;
# TableLabel curTableLabel;
# TableLabel curTitleFields;
# TableLabel callerTitleFields;
# Common dynaRecord = element.runBase().parmDynaLinkRecord();
# Common callerRecord = element.runBase().parmCallerRecord();
# Query aggregatedQuery;
# Map qBds2GroupByFields;
# MapEnumerator me,me2;
# QueryBuildDataSource qBds;
# List fieldList;
# ListEnumerator le;
# FormDataSource fds;
# ;
# if (_eventRule.PrimTableId)
# {
# curDictTable = new SysDictTable(_eventRule.PrimTableId);
# curTableLabel = curDictTable.label() ? curDictTable.label() : '<' + curDictTable.name() + '>';
#
# // Build the 'All' entry
# if (dynaRecord.RecId && _eventRule.isFilterInteractive())
# {
# callerDictTable = new SysDictTable(dynaRecord.TableId);
#
# callerTitleFields = callerDictTable.titleField1() && dynaRecord.(callerDictTable.titleField1())
# ? '(' + strfmt("%1: %2",new SysDictField(callerDictTable.id(),callerDictTable.titleField1()).label(),dynaRecord.(callerDictTable.titleField1()))
# : '';
# callerTitleFields += callerDictTable.titleField2() && dynaRecord.(callerDictTable.titleField2())
# ? callerTitleFields
# ? ', ' + strfmt("%1: %2",new SysDictField(callerDictTable.id(),callerDictTable.titleField2()).label(),dynaRecord.(callerDictTable.titleField2())) + ')'
# : '(' + strfmt("%1: %2",new SysDictField(callerDictTable.id(),callerDictTable.titleField2()).label(),dynaRecord.(callerDictTable.titleField2())) + ')'
# : (callerTitleFields ? ')' : '');
#
# strAll = strfmt("@SYS90569",curTableLabel,callerTitleFields);
# }
# else
# strAll = strfmt("@SYS90557",curTableLabel);
#
# alertMeForRadio.add(element.truncateAlertMeForStr(strAll));
#
# // Build the 'Current' entry
# curTitleFields = curDictTable.titleField1() && callerRecord.(curDictTable.titleField1())
# ? ' (' + strfmt("%1: %2",new SysDictField(curDictTable.id(),curDictTable.titleField1()).label(),callerRecord.(curDictTable.titleField1()))
# : '';
#
# if (_eventRule.IsAggregated)
# {
# aggregatedQuery = element.runBase().parmCallerFormDataSource().queryRun().query();
# qBds2GroupByFields = Map::create(EventRuleData::query2groupByMap(aggregatedQuery));
# me = qBds2GroupByFields.getEnumerator();
# while (me.moveNext())
# {
# qBds = aggregatedQuery.dataSourceNo(me.currentKey());
# fieldList = List::create(me.currentValue());
# le = fieldList.getEnumerator();
# while (le.moveNext())
# {
# if (qBds.table() == callerRecord.TableId && curDictTable.titleField1() && callerRecord.(curDictTable.titleField1()) && le.current() == curDictTable.titleField1())
# continue; // avoid dublicating the title field if also used as group by field
#
# fds = null;
# me2 = element.runBase().eventBuildValidAlertFields().formDataSourceMap().getEnumerator();
#
# while (me2.moveNext())
# if (SysFormDataSource::fds2qbdsNo(me2.currentValue()) == qBds.id())
# fds = me2.currentValue();
#
# if (fds && fds.cursor().(le.current()))
# {
# curTitleFields += curTitleFields ? ', ' : ' (';
# curTitleFields += strfmt("%1: %2",new SysDictField(fds.cursor().TableId,le.current()).label(),fds.cursor().(le.current()));
# }
# }
# }
# curTitleFields += curTitleFields ? ')' : '';
# }
# else
# {
#
# curTitleFields += curDictTable.titleField2() && callerRecord.(curDictTable.titleField2())
# ? curTitleFields
# ? ', ' + strfmt("%1: %2",new SysDictField(curDictTable.id(),curDictTable.titleField2()).label(),callerRecord.(curDictTable.titleField2())) + ')'
# : ' (' + strfmt("%1: %2",new SysDictField(curDictTable.id(),curDictTable.titleField2()).label(),callerRecord.(curDictTable.titleField2())) + ')'
# : (curTitleFields ? ')' : '');
# }
#
#
# strCurrent = strfmt("@SYS90558",curTableLabel,curTitleFields);
# alertMeForRadio.add(element.truncateAlertMeForStr(strCurrent));
#
# // Build the 'Custom' entry
# strCustom = strfmt("@SYS90559",curTableLabel);
#
# alertMeForRadio.add(element.truncateAlertMeForStr(strCustom));
# }
# alertMeForRadio.selection(0);
#}
#
ENDSOURCE
SOURCE #setUntil
#void setUntil(
# EventRule _eventRule
# )
#{
# if (_eventRule.RuleCondition == EventRuleCondition::Current &&
# element.eventRuleFormHandler().parmTmpEventType().TypeId == classnum(EventTypeCUD) &&
# element.eventRuleFormHandler().parmTmpEventType().TypeTrigger == EventTypeTrigger::RecordDelete
# )
# {
# _eventRule.Until = EventUntil::Always;
# eventRule_ds.object(fieldnum(EventRule,UntilDate)).allowEdit(eventRule.Until == EventUntil::UntilDate ? true : false);
# eventRule_ds.refresh();
# }
#}
ENDSOURCE
SOURCE #setRuleCondition
#void setRuleCondition(
# EventRule _eventRule
# )
#{
# if ((_eventRule.RuleCondition == EventRuleCondition::Current && !element.runBase().parmCallerRecord().RecId) ||
# (_eventRule.RuleCondition == EventRuleCondition::Custom && !_eventRule.isFilterInteractive()) ||
# (_eventRule.RuleCondition == EventRuleCondition::Current && element.eventRuleFormHandler().parmTmpEventType().TypeId == classnum(EventTypeCUD)&&
# element.eventRuleFormHandler().parmTmpEventType().TypeTrigger == EventTypeTrigger::RecordInsert)
# )
# {
# alertMeForRadio.selection(EventRuleCondition::All);
# alertMeForRadio.selectionChange();
# }
# eventRule_ds.refresh();
#}
ENDSOURCE
SOURCE #init
#public void init()
#{
# super();
#
# //BP Deviation Documented
# eventRule.setTmp();
# eventRule.setTmpData(element.runBase().parmEventRuleTmp());
# eventRule.checkRecord(false);
#
#}
ENDSOURCE
SOURCE #eventType
#//BP Deviation documented
#edit EventTypeDescriptionRich eventType(
# boolean _set,
# EventRule _eventRule,
# EventTypeDescriptionRich _curEventTypeDescription
# )
#{
# EventTypeDescriptionRich curEventTypeDescription;
#
# if (_set)
# element.runBase().parmRebuildQuery(true);
#
# curEventTypeDescription = eventRuleFormHandler.eventType(_set,_eventRule,element.runBase(),_curEventTypeDescription);
#
# if (_set)
# {
# eventRule_ds.setRuleCondition(_eventRule);
# eventRule_ds.setUntil(_eventRule);
# }
# return curEventTypeDescription;
#}
#
ENDSOURCE
SOURCE #alertField
#//BP Deviation documented
#edit EventFieldLabelRich alertField(
# boolean _set,
# EventRule _eventRule,
# EventFieldLabelRich _alertFieldLabel
# )
#{
# TmpEventAlertField tmpEventAlertField;
# ;
# if (_set)
# {
# tmpEventAlertField = element.runBase().alertFieldChange(_alertFieldLabel);
# _eventRule.initFromTmpEventAlertField(tmpEventAlertField);
# _eventRule.AlertQbdsNo = element.runBase().fdsId2qbdsNo(tmpEventAlertField.DataSourceId);
# eventRuleFormHandler.setEventType(_eventRule,tmpEventAlertField);
# eventRuleFormHandler.setSubject(_eventRule);
# eventRule_ds.setRuleCondition(_eventRule);
# return tmpEventAlertField.Label;
# }
# return element.runBase().parmTmpEventAlertField().Label;
#}
ENDSOURCE
ENDMETHODS
ENDDATASOURCE
ENDOBJECTBANK
JOINS
ENDJOINS
DESIGN
PROPERTIES
Caption #@SYS87774
HideToolbar #Yes
HTMLHelpFile #HTMLHelpFileIWorker
HTMLHelpTopic #AxShared.chm::/html/257e6efa-0176-4acf-a61b-427dd68f4c2c.htm
StatusBarStyle #Simple
ENDPROPERTIES
CONTAINER
CONTROL GROUP
PROPERTIES
Name #OuterFrame
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/5C9B176F-1D84-465D-A590-78657FBF4784.htm
FrameType #None
ENDPROPERTIES
CONTAINER
CONTROL GROUP
PROPERTIES
Name #AlertMeWhen
Width #Column width
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/961D46BC-8066-4464-90AC-C77126872821.htm
Caption #@SYS87775
Columns #2
ArrangeGuide
ARRAY INDEX Columns
#0
#0
ENDARRAY
ENDPROPERTIES
CONTAINER
CONTROL GROUP
PROPERTIES
Name #AlertMeWhen_Left
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/66E4019F-38B8-4A28-9461-E190CBE1BD81.htm
FrameType #None
DataSource #EventRule
ENDPROPERTIES
CONTAINER
CONTROL STRINGEDIT
PROPERTIES
Name #alertField
DataSource #EventRule
Mandatory #Yes
DataMethod #alertField
ENDPROPERTIES
METHODS
Version: 3
SOURCE #validate
#public boolean validate()
#{
# boolean ret;
#
# ret = super();
#
# ret = ret && element.runBase().checkAlertField(this.text());
#
# return ret;
#}
ENDSOURCE
SOURCE #performFormLookup
#public void performFormLookup(FormRun _formRun)
#{
# FormDataSource formDataSource = _formRun.objectSet();
# QueryBuildDataSource qbd = SysFormDataSource::fds2Qbds(formDataSource);
# ;
# qbd.addSortField(fieldnum(TmpEventAlertField,EntireTableEntry));
# qbd.addSortField(fieldnum(TmpEventAlertField,Label));
# formDataSource.cursor().setTmpData(element.runBase().eventBuildValidAlertFields().parmTmpEventAlertField());
# formDataSource.removeFilter();
# super(_formRun);
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL STRINGEDIT
PROPERTIES
Name #eventType
DataSource #EventRule
DataMethod #eventType
ENDPROPERTIES
METHODS
Version: 3
SOURCE #validate
#public boolean validate()
#{
# boolean ret;
#
# ret = super();
#
# ret = ret && eventRuleFormHandler.checkEventType(eventRule,element.runBase().parmTmpEventAlertField(),this.text());
#
# return ret;
#}
ENDSOURCE
SOURCE #performFormLookup
#public void performFormLookup(FormRun _formRun)
#{
# FormDataSource formDataSource = _formRun.objectSet();
# QueryBuildDataSource qbd = SysFormDataSource::fds2Qbds(formDataSource);
# ;
# qbd.addSortField(fieldnum(TmpEventType,Description));
# formDataSource.cursor().setTmpData(eventRuleFormHandler.eventBuildValidEventTypeList(element.runBase().parmTmpEventAlertField().RefTableId,element.runBase().parmTmpEventAlertField().RefFieldId).parmTmpEventType());
# formDataSource.removeFilter();
# super(_formRun);
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertMeWhen_Right
Width #Column width
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/6470FA7E-11EE-497C-9731-0E44263F90B6.htm
FrameType #None
DataSource #EventRule
ENDPROPERTIES
CONTAINER
CONTROL STRINGEDIT
PROPERTIES
Name #primTable
AllowEdit #No
Width #Column width
Skip #Yes
LookupButton #Hidden (but reserve space)
ShowLabel #No
DataSource #EventRule
DataMethod #primTableLabel
ENDPROPERTIES
ENDCONTROL
CONTROL STRINGEDIT
PROPERTIES
Name #X_string
AutoDeclaration #Yes
Width #Column width
LookupButton #Always
ShowLabel #No
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL INTEDIT
PROPERTIES
Name #X_Integer
AutoDeclaration #Yes
Visible #No
Width #Column width
LookupButton #Hidden (but reserve space)
ShowLabel #No
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL COMBOBOX
PROPERTIES
Name #X_Combo
AutoDeclaration #Yes
Visible #No
Width #Column width
ShowLabel #No
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL DATEEDIT
PROPERTIES
Name #X_Date
AutoDeclaration #Yes
Visible #No
Width #Column width
ShowLabel #No
ExtendedDataType
ARRAY
#TransDate
#
ENDARRAY
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL REALEDIT
PROPERTIES
Name #X_Real
AutoDeclaration #Yes
Visible #No
Width #Column width
LookupButton #Hidden (but reserve space)
ShowLabel #No
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL TIMEEDIT
PROPERTIES
Name #X_Time
AutoDeclaration #Yes
Visible #No
Width #Column width
LookupButton #Hidden (but reserve space)
ShowLabel #No
Mandatory #Yes
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL INT64EDIT
PROPERTIES
Name #X_Int64
AutoDeclaration #Yes
Visible #No
Width #Column width
LookupButton #Hidden (but reserve space)
DisplaceNegative #Auto
ShowLabel #No
ENDPROPERTIES
METHODS
Version: 3
SOURCE #modified
#public boolean modified()
#{
# boolean ret;
#
# ret = super();
#
# eventRuleFormHandler.setSubject(eventRule);
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL UTCDATETIMEEDIT
PROPERTIES
Name #X_DateTime
AutoDeclaration #Yes
Visible #No
Width #Column width
ShowLabel #No
ExtendedDataType
ARRAY
#TransDateTime
#
ENDARRAY
ENDPROPERTIES
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertMeFor
Width #Column width
Height #Column height
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/B2A39AA4-2518-4BAE-B391-10549DDC2D22.htm
Caption #@SYS87760
Columns #3
ArrangeGuide
ARRAY INDEX Columns
#0
#0
#0
ENDARRAY
HideIfEmpty #No
ENDPROPERTIES
CONTAINER
CONTROL GROUP
PROPERTIES
Name #AlertMeForRadioGrp
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/47576A86-F6E5-4C79-ADA3-4D583ECA7820.htm
FrameType #None
ENDPROPERTIES
CONTAINER
CONTROL RADIOBUTTON
PROPERTIES
Name #AlertMeForRadio
AutoDeclaration #Yes
FrameType #None
ENDPROPERTIES
METHODS
Version: 3
SOURCE #selectionChange
#public int selectionChange()
#{
# EventRuleCondition curSelection;
# int ret;
#
# ret = super();
#
# curSelection = this.selection();
# eventRule.RuleCondition = curSelection;
# eventRule_ds.write();
# element.runBase().parmRebuildQuery(true);
# eventRule_ds.setUntil(eventRule);
# return ret;
#}
ENDSOURCE
SOURCE #validate
#public boolean validate()
#{
# EventRuleCondition curSelection = this.selection();
# boolean ret;
#
# ret = super();
#
# if (curSelection == EventRuleCondition::Current && !element.runBase().cursorHasRecord())
# ret = false;
#
# if (ret && curSelection == EventRuleCondition::Custom && !eventRule.isFilterInteractive())
# ret = false;
#
# if (ret && curSelection == EventRuleCondition::Current && element.eventRuleFormHandler().parmTmpEventType().TypeId == classnum(EventTypeCUD) &&
# element.eventRuleFormHandler().parmTmpEventType().TypeTrigger == EventTypeTrigger::RecordInsert)
# ret = false;
#
# return ret;
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #DialogStartGrp
Visible #No
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/C0332332-2942-4352-873E-0E2C650B3CC2.htm
ENDPROPERTIES
CONTAINER
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #InvisibleGroup
Visible #No
Left #Right edge
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/5E58A71C-10B7-4CDA-8246-685B6FFA7862.htm
FrameType #None
ENDPROPERTIES
CONTAINER
CONTROL BUTTONGROUP
PROPERTIES
Name #RightButtonGrp
AutoDeclaration #Yes
Left #Auto (right)
Top #Bottom edge
ENDPROPERTIES
CONTAINER
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #SelectButtonGroup
Left #Right edge
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/D1DC7633-0DD2-4243-A32B-B16E05A6B716.htm
FrameType #None
ENDPROPERTIES
CONTAINER
CONTROL BUTTONGROUP
PROPERTIES
Name #ManualRightButtonGrp
AutoDeclaration #Yes
Left #Auto (right)
Top #Bottom edge
ENDPROPERTIES
CONTAINER
CONTROL MENUITEMBUTTON
PROPERTIES
Name #RunBaseQueryDialog
MenuItemName #RunBaseQueryDialog
ENDPROPERTIES
METHODS
Version: 3
SOURCE #clicked
#void clicked()
#{
# if (alertMeForRadio.selection() != 2)
# {
# alertMeForRadio.selection(2);
# alertMeForRadio.selectionChange();
# }
# super();
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertMeHowOften
AutoDeclaration #Yes
Width #Column width
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/CA485A32-12B7-493C-BB21-B781D5872BBA.htm
Caption #@SYS87762
FrameOptionButton #Hide
Columns #2
ArrangeGuide
ARRAY INDEX Columns
#0
#0
ENDARRAY
ENDPROPERTIES
CONTAINER
CONTROL RADIOBUTTON
PROPERTIES
Name #RadioButton1
DataSource #EventRule
DataField #Until
Columns #2
FrameType #None
ENDPROPERTIES
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertMeUntilDate
Height #Column height
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/954B716D-5CE9-4C9E-86F5-C9DEF8C47A0A.htm
FrameType #None
BottomMargin #0
ENDPROPERTIES
CONTAINER
CONTROL DATEEDIT
PROPERTIES
Name #EventRule_UntilDate
VerticalSpacing #0
ShowLabel #No
DataSource #EventRule
DataField #UntilDate
ENDPROPERTIES
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertMeWith
AutoDeclaration #Yes
Width #Column width
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/E7E45517-8B52-466C-8EC9-4D4D475BB7F3.htm
Caption #@SYS87777
FrameOptionButton #Hide
ENDPROPERTIES
CONTAINER
CONTROL STRINGEDIT
PROPERTIES
Name #EventRule_Subject
Width #Column width
DataSource #EventRule
DataField #Subject
ENDPROPERTIES
ENDCONTROL
CONTROL STRINGEDIT
PROPERTIES
Name #EventRule_Message
Width #Column width
MultiLine #Yes
DataSource #EventRule
DataField #Message
ENDPROPERTIES
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertWho
AutoDeclaration #Yes
Width #Column width
Height #Column height
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/B5E962D9-A63B-4E81-944B-B1422C0BCB71.htm
Caption #@SYS91445
FrameOptionButton #Hide
ENDPROPERTIES
CONTAINER
CONTROL STRINGEDIT
PROPERTIES
Name #EventRule_UserId
DataSource #EventRule
DataField #UserId
ENDPROPERTIES
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #RecipientSelectButtonGroup
Left #Right edge
FrameType #None
ENDPROPERTIES
CONTAINER
CONTROL BUTTONGROUP
PROPERTIES
Name #RecipientManualRightButtonGrp
AutoDeclaration #Yes
Left #Auto (right)
ENDPROPERTIES
CONTAINER
CONTROL MENUITEMBUTTON
PROPERTIES
Name #NVMPEventRuleRecipients
MenuItemName #NVMPEventRuleRecipients
ENDPROPERTIES
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertBy
AutoDeclaration #Yes
Width #Column width
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/23844CE7-CDC0-4ED4-BBDA-AA8CD6312382.htm
Caption #@SYS94032
FrameOptionButton #Hide
ENDPROPERTIES
CONTAINER
CONTROL CHECKBOX
PROPERTIES
Name #EventRule_ShowPopup
AutoDeclaration #Yes
HelpText #@SYS94033
Value #1
Label #@SYS87695
ENDPROPERTIES
METHODS
Version: 3
SOURCE #toolTip
#public str toolTip()
#{
# return '@SYS94258';
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #AlertMeByBottom
HTMLHelpFile #HTMLHelpFileAxShared
HTMLHelpTopic #html/65495EBB-D7C4-47A2-9BF0-0CF15BCB7FA1.htm
FrameType #None
Columns #2
ArrangeGuide
ARRAY INDEX Columns
#0
#0
ENDARRAY
ENDPROPERTIES
CONTAINER
CONTROL CHECKBOX
PROPERTIES
Name #EventRule_SendEmail
AutoDeclaration #Yes
HelpText #@SYS94034
Label #@SYS94049
ENDPROPERTIES
METHODS
Version: 3
SOURCE #toolTip
#public str toolTip()
#{
# return '@SYS94259';
#}
ENDSOURCE
ENDMETHODS
ENDCONTROL
CONTROL STRINGEDIT
PROPERTIES
Name #EventRule_SendEmailAddress
AutoDeclaration #Yes
AllowEdit #No
ENDPROPERTIES
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL BUTTONGROUP
PROPERTIES
Name #ButtonGroup
Left #Auto (right)
Top #Bottom edge
ArrangeMethod #Horizontal, flush right
ENDPROPERTIES
CONTAINER
CONTROL COMMANDBUTTON
PROPERTIES
Name #CommandButtonOK
HelpText #@SYS74139
Text #@SYS5469
Command #263
ENDPROPERTIES
ENDCONTROL
CONTROL COMMANDBUTTON
PROPERTIES
Name #CommandButtonCancel
HelpText #@SYS16581
Text #@SYS57717
Command #264
ENDPROPERTIES
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDDESIGN
ENDFORM
***Element: FRM
; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5
FORM #NVMPEventRuleRecipients
PROPERTIES
Name #NVMPEventRuleRecipients
ENDPROPERTIES
METHODS
Version: 3
SOURCE #classDeclaration
#public class FormRun extends ObjectRun
#{
#}
ENDSOURCE
SOURCE #init
#public void init()
#{
# ;
# if(!element.args().record() || (element.args().record().TableId != TableNum(EventRule)))
# {
# throw error("This form must be called from the event rule creation form");
# }
#
# super();
#}
ENDSOURCE
ENDMETHODS
OBJECTBANK
PROPERTIES
ENDPROPERTIES
DATASOURCE
OBJECTPOOL
PROPERTIES
Name #HELEventRuleReceipients
Table #NVMPEventRuleRecipients
InsertIfEmpty #No
ENDPROPERTIES
FIELDLIST
DATAFIELD EventRuleId
PROPERTIES
Skip #Yes
ENDPROPERTIES
ENDDATAFIELD
ENDFIELDLIST
ENDOBJECTPOOL
ENDDATASOURCE
ENDOBJECTBANK
JOINS
ENDJOINS
DESIGN
PROPERTIES
Caption #Event rule recipients
TitleDatasource #HELEventRuleReceipients
ENDPROPERTIES
CONTAINER
CONTROL TAB
PROPERTIES
Name #Tab
Width #Column width
Height #Column height
ENDPROPERTIES
CONTAINER
CONTROL TABPAGE
PROPERTIES
Name #Overview
Caption #@SYS9039
ENDPROPERTIES
CONTAINER
CONTROL GRID
PROPERTIES
Name #Grid
Width #Column width
Height #Column height
DataSource #HELEventRuleReceipients
DataGroup #Overview
AutoDataGroup #Yes
ENDPROPERTIES
CONTAINER
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
CONTROL TABPAGE
PROPERTIES
Name #General
Caption #@SYS19924
ENDPROPERTIES
CONTAINER
CONTROL GROUP
PROPERTIES
Name #Identification
DataSource #HELEventRuleReceipients
DataGroup #Identification
AutoDataGroup #Yes
ENDPROPERTIES
CONTAINER
ENDCONTAINER
ENDCONTROL
CONTROL GROUP
PROPERTIES
Name #User
DataSource #HELEventRuleReceipients
DataGroup #User
AutoDataGroup #Yes
ENDPROPERTIES
CONTAINER
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDCONTROL
ENDCONTAINER
ENDDESIGN
ENDFORM
***Element: FTM
; Microsoft Dynamics AX MENUITEM : NVMPEventRuleRecipients unloaded
; --------------------------------------------------------------------------------
VERSION 1
MENUITEM #NVMPEventRuleRecipients
Type: 1
PROPERTIES
Name #NVMPEventRuleRecipients
Label #@SYS39575
HelpText #Use to specify multiple recipients for the alert's email
Object #nvmpeventRuleRecipients
ENDPROPERTIES
ENDMENUITEM
***Element: PRN
; Microsoft Dynamics AX Project : KeSae_AlertMultipleUsers unloaded
; --------------------------------------------------------------------------------
PROJECTVERSION 2
PROJECT #KeSae_AlertMultipleUsers
SHARED
PROPERTIES
Name #KeSae_AlertMultipleUsers
ENDPROPERTIES
PROJECTCLASS ProjectNode
BEGINNODE
FILETYPE 0
UTILTYPE 41
UTILOBJECTID 50080
NODETYPE 228
NAME #NVMPEventRuleMultipleRecipients
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 44
UTILOBJECTID 292
NODETYPE 204
NAME #EventRule
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 44
UTILOBJECTID 50026
NODETYPE 204
NAME #NVMPEventRuleRecipients
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 45
UTILOBJECTID 3695
NODETYPE 329
NAME #EventActionEmail
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 45
UTILOBJECTID 2513
NODETYPE 329
NAME #EventCreateRule
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 11
UTILOBJECTID 0
NODETYPE 201
NAME #EventCreateRule
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 11
UTILOBJECTID 0
NODETYPE 201
NAME #NVMPEventRuleRecipients
ENDNODE
BEGINNODE
FILETYPE 0
UTILTYPE 1
UTILOBJECTID 0
NODETYPE 296
NAME #NVMPEventRuleRecipients
ENDNODE
ENDPROJECT
***Element: END