Solved

Readers names via agent in Lotus Notes

Posted on 2011-03-04
6
629 Views
Last Modified: 2013-12-18
Hi,

I have created a field in a Notes document which I have populated with a list of user names and groups. Although I updated the form to include the new field I popoulated my existing documents with an agent and as a consequence the field types are not flagged as Readers, just TEXT LIST.

I therefore ran this agent

Sub Initialize()
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim doc As NotesDocument
      Dim item As NotesItem
      
      Set db = session.Currentdatabase
      Set view = db.getView("Restricted Purchase Orders")
      Set doc = view.GetFirstDocument
      Do While Not(doc Is Nothing)
            Set item = doc.GetFirstItem("RestrictedViewers")
            item.IsNames = True
            item.IsReaders = True
            Call doc.Save(True,True)
            Set doc = view.GetNextDocument(doc)
      Loop
End Sub

which fails to update the field types. The field Restricted Viewers still shows as Text List and doesn't have the READERS or NAMES flags against it.

What is the easiest way to accomplish this ?

Thanks - Andy
0
Comment
Question by:andyhines
6 Comments
 
LVL 10

Expert Comment

by:doninja
ID: 35038341
Get the agent to recreate the field from scratch instead of modifying the existing field

Get the values from the field, then remove item, save the doc to make sure change is committed, add the new item with is reader set before the save. then finally save the document.

You can change properties of an existing field such as is summary, but cannot change it's type once created.
0
 
LVL 7

Expert Comment

by:Sam654
ID: 35041345
Your original Agent should have done this to preserve the field type.
Call doc.ReplaceItemValue( "RestrictedViewers" , "NewValue" )

Now you're going to have to put this into an agent to update the fields.
Dim myReaders As NotesItem
Set myReaders = New NotesItem( doc , "RestrictedViewer" , "NewValue", READERS )

If there are multiple values to enter you'll have to build up a list first and put that instead of "NewValue".
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 35042683
That's one way to do it.

The other way:
      Set item= doc.ReplaceItemValue( "RestrictedViewers" , "NewValue" )
      item.isReaders= True
and save the document.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:andyhines
ID: 35044107
Thank you all for your quick responses. Let me try this on Monday and I'll see how it goes..

Andy
0
 

Author Closing Comment

by:andyhines
ID: 35054922
Spot on. Thank you.
0
 

Author Comment

by:andyhines
ID: 35054931
All answers were correct bu Sjef's gave me the fastest easiest fix. Worked first time. Thank you all...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Event in Notes Form after open and visible 10 222
Lotus Domino 9.0 install on same pc with 8.5.3 9 134
Domino Server 11 72
Lotus notes - Follow up notes mail missing 15 77
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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