• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

how to send mail to default user - a custom role

Hi all,
Several custom roles are created in the ACL.
Now we would like to email to several default
such roles in our app. How should it be be done
so that this is possible?
thanks.

0
damoncwk
Asked:
damoncwk
  • 3
  • 2
2 Solutions
 
Bozzie4Commented:
The easiest way to solve this, is not add people directly to your ACL, but put them in groups first, and assign the roles to the groups.  This has the added advantage, that you can give people the right to grant access to other people without giving them Manager access in your database (they only need to have Author access on the names.nsf, and listed in the Administrators field for the particular group).

Normally, I use a simple naming scheme, for instance <application name>_<role>_<general access> (create your own naming schemes as you see fit, of course).

For a group in the AnApplication application, that has the Revisor role, and has Author access in the database, I would name it
AnApplication_Revisor_Author

Users can then mail this group, to reach everybody who has the Revisor role


Other solutions require writing a lotusscript, to examine all entries in the ACL, and sending the emails based on those results....

cheers,

Tom
0
 
qwaleteeCommented:
Dim s as new notesSession
Dim db as notesDatabase
Set db = s.currentDatabase
Dim addr as string
Dim acl as notesAcl
Set acl = db.acl
Dim entry as notesAclEntry
Set entry = acl.getFirstEntry
Do Until entry is nothing
    if entry.isRoleEnabled(  "[" & NAME_OF_ROLE & "]"   ) then
        addr = addr & entry.name & ","
    end if
    Set entry = acl.getNextEntry(entry)
Loop

Dim msg as notesDocument
Set msg = db.createDocument
msg.replaceItemValue "Form" , "Memo"
msg.replaceItemValue "Subject" , "something"
msg.replaceItemValue "Body" , "main message" 'you might want to switch to rich text
msg.replaceItemValue "SendTo" , addr
Dim filler
filler = Evaluate(|
FIELD SendTo := @Explode(SendTo;",");
CONTNUE
|,msg)
msg.send false
0
 
damoncwkAuthor Commented:
qwaletee,
for your script i tried to add the following
FIELD CopyTo :=@Explode(CopyTo;",");
in order to send cc mail.
However the person specified in the form field "CopyTo" did
not receive any mail after this.

I can mail to the cc mail if I use formula however for your script
I cannot accomplish this part in addition to your comment. Thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
qwaleteeCommented:
the reasib I had the FIELD SendTo... stuff is as follows:

As I process the ACL, I build a string called ADDR that contains multiple names separated with commas.  It looks sort of like a regular Notes memo recipient list:
damoncwk,bozzie4,qwaletee

But ADDR, is only a LotusScript variable, I need it on the form, so I use:

msg.replaceItemValue "SendTo" , addr

Now, here comes a small problem.  Even though in a memo, it looks like the names are a single string separated by commas, it doesn't really work this way.  they are multiple separate values, known as a list (simialr to arrays), and the list DISPLAYS its multiple values separate dby commas.  Here, we are actually using a single string, not a list field, and Notes will think it is one e-Mail address that has two commas in the middle, not three separate e-mail addresses.

So, I need to find a way to break the string at the commas into a list.  The @Explode formula does that.

You tried to add an @Explode formula for CopyTo.  But yo weren't aware of the mechanisc of why I did the explode.  Since I assigned SendTo to start with, the @Explode had a value to work on.  You didn't assign a CopyTo value (via ReplaceItemValue), so there was a blank string.  The fact that YOUR form contained a CopyTo field is irrelevant because I am not sending your form's data.  I am not even looking at it.

So, you need something like:

msg.replaceItemValue "CopyTo" , "some address"

And if the value you put in is a single address, you won't need an @Explode for it either.  Only bother with @Explode if you put in something like:
msg.replaceItemValue "CopyTo" , "some address,another address"
0
 
damoncwkAuthor Commented:
Hi qwaletee,
still digesting your reply.
And how can I include a doclink in the msg?
0
 
qwaleteeCommented:
This is abandoned.  However, I noticed that I never answered the "extra credit" question at the end, so here goes...

Replace:
msg.replaceItemValue "Body" , "main message" 'you might want to switch to rich text

With:
Dim doc as notesDocument
Set doc = s.documentContext
'just an example... you need to set doc to some Notes document, you might also try dim ws as new notesUiWorkspace : Set doc = ws.currentDocument.document
Dim body as new notesRichTextItem ( msg )
msg.appendText "main message" 'you might want to switch to rich text
msg.addNewLine 2
msg.appendDocLink doc "Link text" 'replace this too

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now