| || |
Auto email of requirement on \"assigned to\" change
This is the customisation code I have created to automatically email a requirement to the new assignee when the assigned to field changes.
Since it took me a while, I though it would be wise to post to save other people the time and effort.
On Error Resume Next
' On post of requirement, send email when the assigned to has changed
' If the assigned to has changed
If Req_Fields("RQ_REQ_AUTHOR").IsModified Then
' and the value of the assigned to in not empty
If Req_Fields("RQ_REQ_AUTHOR").value <> "" then
'Get the details of the requirement
strAssignedTo = Req_Fields("RQ_REQ_AUTHOR").Value
strReqId = Req_Fields("RQ_REQ_ID").Value
strCC = ""
strSubject = "Requirement " & strReqId & " has been assigned to you."
strComment = strReqId & " has been assigned to you. Please review or update accordingly."
'Initiate the function to send the email
On Error GoTo 0
' This function sends an email for a requirement
function Req_Mail(strReqId,strAssignedTo,strCC,strSubject,s trComment)
set objReqFactory = TDConnection.ReqFactory
set objReq = objReqFactory(strReqId)
' msgbox "ReqId: " & strReqId & chr(10) & _
' "AssignedTo: " & strAssignedTo & chr(10) & _
' "CC: " & strCC & chr(10) & _
' "Subject: " & strSubject & chr(10) & _
' "Comment: " & strComment & chr(10)
objReq.Mail strAssignedTo, _
set objReqFactory = nothing
set objReq = nothing