Solved

Readers names via agent in Lotus Notes

Posted on 2011-03-04
6
635 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 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