Update reader field with an agent



I tried to write an agent to enter some usernames into a reader field using an agent. It works but the inserted data is not interpreted well : after i add the users to the reader fields  , everyone can still access the document.
Only after i save the document , the access is restricted.
It looks that only after opening the doc in the UI the reader functionality is starting to work.
What am i doing wrong ?
Should i look out for some things ?
212f_h2oAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZvonkoSystems architectCommented:
Yes, there is a field attribut telling the field it is a Readers field.
You have to set this options too.
Like this:
Call item.AppendToTextList( "Jeffrey Kinnamon" )
item.IsReaders = True
Call doc.Save( True, False )

Good luck,
Zvonko


0
scottrmaCommented:
Make sure your field type is set to READERS. Check how you are creating and/or updating the field. If you use:

Set field = New NotesItem(doc,field,"Admins",READERS)

that should make it a Readers field. You can also use NotesItem.IsReaders property to check to see if the field has the READERS type.

Check the document properties box for this field - I suspect it does not have the READERS property set. If not, you must set it in your agent as described above.

Hope this helps.

Scott
0
scottrmaCommented:
Hello Zvonko,

Your comment was not there when I started writing....

Cheers,

Scott
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

212f_h2oAuthor Commented:

Is there a way to do it with Formula ?
0
ZvonkoSystems architectCommented:
It's ok.

I was only confused how in your example the variable "field" can be at same time NotesItem and String :-)

0
ZvonkoSystems architectCommented:
I can not get ride of the assumption that h2o is Steamer :-)

Buddy you know that this would be dangerous game?

0
HemanthaKumarCommented:
It is possible in Formula,

Here is the sample code, which appends the a user to the readers field in canonical format

FIELD Readers := Readers : @Name([Canonicalize];"TestID/Company")

Also make your readers field as Computed, with default value as

Default Readers := @UserName;
Readers

~Hemanth


0
212f_h2oAuthor Commented:
Thanx

works great , except that the Rader's are added it to the field. How can I change it so I replace the contents instead of adding it to the list of users already present in the reader's field.
I tried to delete the field using @Deletefield first , but apparently my agent executes the Delete at the end of the agent. I could do it with 2 agents but I guess there's a more elegant way to do it.
0
HemanthaKumarCommented:
Replace with this formula.

FIELD Readers := @Name([Canonicalize];"TestID/Company")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.