Solved

Readers names via agent in Lotus Notes

Posted on 2011-03-04
6
616 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

11 Experts available now in Live!

Get 1:1 Help Now