Solved

Modifying Dynamic Author Fields

Posted on 2001-06-21
5
216 Views
Last Modified: 2013-12-18
Hello All

Does anyone have any sample code (formula and Script if possible) that modifies Author/reader fields?

I've never really refined access that far before, and I'm in a big hurry, so anything I can rip off would be most appreciated...I've even being generous with the points...

Cheers

Ian
0
Comment
Question by:IanWood
[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
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:sloeber
ID: 6213980
What do you mean with modify
Just set the folowing in the author/readers field
@Name([CN];@UserName) : "[Role]" : "Name" ..........

May be a little hint, say that you have several Divisions in your company.
Only the persons with the same division may read the document
Then you have in your form a dblookup that looks to the users division, and put this in the field Division

So, in the readers field you wright now
"[" + Division + "]"

Is this enough explanation or do you need more.
Always use the [CN] name, in a readers field, except for roles ;-)

Greets,
Sloeber
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 100 total points
ID: 6214098
run this agent on selected documents,

dim session as new NotesSession
dim db as notesdatabase
dim col as Notesdocumentcollection
dim doc as notesdocument
dim item as Notesitem

set db = session.CUrrentDatabase
set col = db.UnprocessedDocuments
set doc = col.GetFirstDocument
while not doc is nothing
set item = doc.GetFirstItem("Author")
Call item.AppendToTextList( "Ianwood/ou/o" )  ' use this if you want to add some name to the existing authors field
doc.Author = "Ianwood/ou/o" ' use this if you want to replace ahole authors field
item.IsAuthors = true
call doc.Save(true,false)
set doc = col.GetNextDocument(doc)
wend

PS: Similarly for readers field use, item.Readers=True

~Hemanth
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6214109
I believe that it's also necessary to refresh the documents, but I'm not sure
0
 
LVL 1

Expert Comment

by:anuu
ID: 6214924
hey Hemanth,

A small clarification... if  a document does not already contain an Authors field, then wont it spring up an error on getfirstitem method?


anu
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6215001
Anuu you are right!

The question says that, he wants to modify the field, so I assume that he has one.

If you don't have one then use extended class syntax that I commented out in the script.

To Ianwood

Comment out this line, somehow I missed it

' doc.Author = "Ianwood/ou/o" ' use this if you want to replace whole authors field

~Hemanth
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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