| || |
Mailing defect details
Automail provides to select mail fields and select the users to receive the email. The user list includes Assignee/Resolver and Reported By in addition to project users. I would like to trigger an email to modifier also if modifier is not an Assignee/Reported By and specific fields are changed. I am planning to do like
In Bug_canpost Defect Workflow,
1). Find out if there are changes to specific fields by querying BUG table with current information.
(Question: Is there another way to check whether the specific fields changed without querying the table?)
2). If so, Call MailDefect subroutine, which is defined in the OTA reference.
Is there any other process to achieve this?
Is possible to include [Current User] to the user list in Automail list?
Any help will be appreciated.
Re: Mailing defect details
There is a IsModified property for the Field objects (e.g. If Bug_Fields("BG_YOU_NAME_IT").IsModified Then...) but if a user changes a value and then sets it back to its original value, IsModified will be True.
Another way is to record the field values in some global dictionary object when in MoveTo and check if any / some / all fields have changed in CanPost. Something like :
<font class="small">Code:</font><hr /><pre>
Set rgLastBugValues = CreateObject("Scripting.Dictionary")
Public Sub RefreshLastValues(Fields, rgLastValues)
'remove all the items and start fresh
'populate dictionary with field values
For i = 0 to Fields.Count - 1
rgLastValues.Add Fields.FieldById(i).FieldName, Fields.FieldById(i).Value
Function GetLastValue(FieldName, rgLastValue)
'Check to see if the requested field exists in the dictionary
If rgLastValues.Exists(CStr(FieldName)) Then
'return last field value
GetLastValue = rgLastValues.Item(CStr(FieldName))
GetLastValue = vbNullString
RefreshLastValues Bug_Fields, rgLastBugValues
If GetLastValue ("BG_YOU_NAME_IT", rgLastBugValues) Then
If any of the fields you need to check is a foreign key (e.g. a Release, a Cycle, a Test Subject), you'll need to adapt that code because the field value will be an object.