Agent to creat documets

Hello all:I have an agent that creates documents in a db ,any one with the role [InvMetrics]can run the agent through an action,what happens is when a user with an access level less that esitor runs the agent he gets an error message"You are not allowed to delete or update document since you are not listed as an allowable author for this document",I can’t give those users editor access because that way they can edit any document and change it’s contents

I tried putting current user name in the document using

Metricsdoc.Author= session.UserName

but still it did not work

any ideas or comments

Thanks in advance

Dalia

Subject: agent to creat documets

When you create an Authors or Readers-type field in Lotusscript, you have to create it explicitly. “doc.Authors = Name” isn’t good enough, nor is the format of the name you’re trying to add.

Something like this will do the trick:

Set itm = doc.GetFirstItem("Authors")



If Not(itm Is Nothing) Then

	Call itm.AppendToTextList(session.UserName)

	itm.IsAuthors = True

Else

	Set itm = New NotesItem(doc, "Authors", session.UserName, AUTHORS)

End If

Here we’re ensuring that the field named “Authors” is always an Authors-type field, and not just plain ole’ text. Also, we’re not using a common name. That’s no good for security related fields, you should be using a fully-distinguished Notes name.

Subject: RE: agent to creat documets

Hi ,Thanks again

but Authors is an author type field in my document and it is cerated visualy not through a script ,do you mean that

thanks

Dalia

Subject: RE: agent to creat documets

but Authors is an author type field in my document and it is cerated visualy not through a script ,do you mean that

I don’t understand what you mean. If you’re talking about how you’ve defined the field in your form design, that’s irrelevant from the point of view of any Lotusscript / Java code you have running. When you manipulate a field through code, the code isn’t necessarily aware of the field’s data type (this is not the case in @formula). This is why you need to explicitly set the relevant field type in your code.

However, to come back to your issue, if you want users below Editor to be able to create documents:

They need at least Author access with the “Create documents” option ticked or;

They need to be able to “Write public documents” and your document form design(s) need to cater for this also.

You need to check the relevant form design to ensure there are no form-level restrictions for document creation.

Subject: RE: agent to creat documets

Hi benpool,I tried and I ran the debugger and while debugging I found the authors field with the user’s name in it but still I got the same error

I dont know why is that

thanks again

Dalia

Subject: What access level do the users in question have? (WAS: agent to creat documets)

Subject: RE: agent to creat documets

Thank for the explanations,I will give it a try,some times I feel I don’t under stand the core of the lotus notesthanks again

Dalia