Solved

LotusScript code needed...Please help !!!

Posted on 2002-03-25
11
476 Views
Last Modified: 2013-12-18
Hi Experts,

I'm looking for a piece of code to implement in a application. I can't write LotusSrcript (yet) and I think in this case I need to do this function using LotusSript...

When I want to assign values whitin Readers or Author fields, I can assign these addresses using the Address dialog from the names.nsf on the server.
I want that the user is able to assign a group of user from their personall addressbook.

Can anybody create such code for me ?

Greetings,

Bob
0
Comment
Question by:oosterbaan
  • 5
  • 3
  • 3
11 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6894062
Use this in a button to select readers/Authors and set it to field accordingly,

NotesID := @PickList( [Custom]  ; "" : "names.nsf" ; "($VIMPeopleByLastName)" ; "Title" ; "Please select the notes id's " ;5);

@prompt([ok]; ""; NotesID);

FIELD Readers := Readers : NotesID;
FIELD Authors := Authors : NtoesID;
@True

~Hemanth
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6895080
Thanks Hemanth,

You"re getting close, but this is not exactly what I was "trying" to ask (-:

I must be more clearly... (I Think). Users has created their own groups in their PAB. I want that people are able to select those groups. I think that after selecting a groupname, such a groupname must be divided into the residing IDs

Greetings,

Bob
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 200 total points
ID: 6895249
Here is the script, which goes in a button

Sub Click(Source As Button)
     Dim session As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim item As NotesItem    
     Dim NamesDB As NotesDatabase
     Dim GroupDoc As NotesDocument
     Dim GroupView As NotesView
     
     server = ""
     dbpath = "names.nsf"    
     
     Set db = session.CurrentDatabase
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.document
     groups = workspace.PickListStrings( PICKLIST_CUSTOM, True, server, dbpath, _
     "Groups", "Groups List", "Choose a group", 2 )
     
     Set NamesDB = New NotesDatabase(server,dbpath)
     Set GroupView = NamesDB.GetView("($PeopleGroupsFlat)")
     count = 0
     Forall groupName In groups
          Set GroupDoc = GroupView.GetDocumentByKey(groupName)
          Set item = GroupDoc.GetFirstItem("Members")
          Forall names In item.values
               Redim Preserve members(count) As String
               members(count) = names    
               count = count + 1
          End Forall
     End Forall
     ' Set the field to the members
     doc.Members = members
     
End Sub


PS: I ASSUMED THAT THERE IS A FIELD CALLED MEMBERS WHICH STORES THE RESULT
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6895384
Hello Bob,

I assume you have an Authors field with the field name: GroupMembers
This field should be controled by the contenet of another field with the name: GroupName

The field GroupMembers is Computed and has this formula:
FIELD GroupName:=GroupName;
@If(GroupName="";@Return("");"");
tmpGroupMemebers:=@DbLookup("";"":"names.nsf";"Groups";GroupName;"Members");
@If(@IsError(tmpGroupMemebers);"";tmpGroupMemebers)

The effect is, when a valid GroupName is found in local names.nsf, then are its Member names placed into Author field named GroupMembers.

If you want to offer an input help for the GroupName field, then place this formula into InputTranslation of GroupName field:
@If(GroupName="";@PickList([Name]);@Trim(GroupName))

Is this something for you?


0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6897459
Thanks...really great script and works fine...

Also thx to you Zvonko for your suggestion !!!

Greetings,

Bob

P.S. Is it also possible to concatenate the result of this script to the field members (so if there is already a value in it, it will be appended ?)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6897501
Then use appendtotextlist method

last line, doc.Members = members will transform as

dim memItem as NotesItem
set memItem = doc.GetFirstItem( "Members" )
Call memItem.AppendToTextList( members )
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6897516
Thx HemanthaKumar.....
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6897551
Bob, it is always good to have working LotusScript code,
but it is even better to have short handy @Formulas...

So I hope next time :-)

So long,
zvonko
 
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6897768
No Zvonko.....You're wright. I'll try your option also (tomorrow) and get back to you later....
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6903578
No need for this Bob. I am on vacation for a while and Heman is really a great help in any situation (when does this man sleep :-)
It is only fair that he gets the points :-)

Cheers,
zvonko

0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6903681
Thx Zvonko, but I'm really interested in your solution also... You are both point junkies (-: So you will get you're share !!

Happy hollydays....

Bob
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LOtus Notes 6.5 low performance 13 36
Email relaying to outside address 4 161
Lotus Notes 8.5 1 140
Text over two lines in VBA for email 26 159
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now