Hi
I am in the process of testing email notifications after creation of a certain item using CCO.Email.SendEmailToIdentityEx(....), which is set to trigger after "onAfterAdd". I need to configure this for users across couple of geographical locations (on the same network). Required permissions to add, update, etc for creating and updating the item have been granted.
While this works very well for all users at my geographical location, it is not working (ie, I am unable to save-unlock-close the new item) when I test it with the logins of users from other locations , unless, the user(s) are added to the "administrators" identity.
The code being used as as follows: -
If Me.GetType() <> "My Item" Then Return Me
Dim inn As Innovator = Me.newInnovator()
Dim itemAction as String = Me.getAttribute("action")
Dim inItem = Me.apply("do_l10n")
If inItem.isError() Then Return inItem
Me.setAttribute("action", itemAction)
'+++ Email to My Team
Dim myTeam As String = "MY TEAM"
'+++ Generate and fill todentityName array +++
Dim myitemProperty As String = inItem.getProperty("myitem_property")
Dim myItemId As String = inItem.getID()
'--- Generate and fill fromIdentityName ---
Dim fromIdentityId As String = CCO.Permissions.GetIdentityIDbyName("Innovator Admin")
'+++ Getting the Login Name for From Identity for EMail+++
Dim xml As String
xml = "<AML>" & _
"<Item type='User' action='get' select='login_name'>" & _
"<Relationships>" & _
"<Item type='Alias' action='get'>" & _
"<related_id>" & _
"<Item type='Identity' action='get' id='" & fromIdentityId & "' />" & _
"</related_id>" & _
"</Item>" & _
"</Relationships>" & _
"</Item></AML>"
Dim res As Item = inItem.getInnovator().applyAML(xml)
If res.isError() Then Return res
Dim fromUserName As String = res.getProperty("login_name")
'+++ Generate and fill the Body of the EMail using Project and Activity Details +++
Dim protocol As String = "http"
Dim host As String = HttpContext.Current.Request.Url.Host
Dim port As String = HttpContext.Current.Request.Url.Port
Dim vDir As String = ""
Dim count As Integer = HttpContext.Current.Request.Url.Segments.Count
For index As Integer = 1 To (count - 3) 'Ignoring "Server/InnovatorServer.aspx"
vDir += HttpContext.Current.Request.Url.Segments(index)
Next
If port <> "80" Then
host += ":" + port
End If
If HttpContext.Current.Request.IsSecureConnection <> False Then
protocol = "https"
End If
Dim htmlBody As String = "" & _
"<body>" & _
"A new my item has been created." & _
"The details of the item created are given below."& _
"<br><br>" & _
"My Item Property: "& myitemProperty & "<br>" & _
"<br><br>" & _
"</body>"
'+++ Complete generating the Body of the EMail +++
If Not String.IsNullOrEmpty(myTeam ) Then
CCO.Email.SendEmailToIdentityEx(myTeam , "New My Item Created for : "& myTeam & "","", htmlBody, fromUserName)
End If
'+++ The command for sending the EMail +++
Return Me
Will be great if someone has also faced this issue and can indicate the solution.
Regards