Notify Opportunity Owner for Incoming Email
We have a requirement to send Bell Notification to Opportunity Owner, when an incoming email is received for an email which was sent using "Send Email" smart action in Redwood.
We are aware of the feature which notifies the Original Email Sender (who might not be the owner of the opportunity) when recipient responds to their email, our case is, we also want to notify the Opportunity Owner.
Have placed the below Script (Before Insert and also checked with After Changes posted to DB Trigger) on the Conversation Message Object, but the notifications are not received by the Owner.
def msgType = getAttribute("MessageTypeCd")
def inboundStatus = getAttribute("InboundStatusCd")
if (msgType != "ORA_SVC_INBOUND" || inboundStatus == null) {
return
}
def objectType = getAttribute("ObjectTypeCd")
def objectId = getAttribute("ObjectId")
if (objectType != "OPPORTUNITY" || objectId == null) {
return
}
def optyVO = newView("OpportunityVO")
optyVO.appendViewCriteria("OptyId = ${objectId}")
optyVO.executeQuery()
def optyRow = optyVO.first()
if (optyRow == null) {
return
}
def ownerPartyId = optyRow.getAttribute("OwnerResourcePartyId")
def optyName = optyRow.getAttribute("Name")
if (ownerPartyId == null) {
return
}
def map = new HashMap()
map.put("Channels", ["ORA_SVC_BELL"])
map.put("MessageText", " Notification from Groovy Script:: New inbound email received for Opportunity: " + optyName)
map.put("RecipientPartyId", ownerPartyId)
adf.util.sendNotification(adf, map)
Tagged:
0