?
Solved

Readers names via agent in Lotus Notes

Posted on 2011-03-04
6
Medium Priority
?
664 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 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

839 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