Authors fields & run on behalf of agent

I have an agent that is triggered via the querysave of a document. The agent is enabled to Run on behalf of an ID which has author access to a group of documents. The agent is signed by an ID which is named in the server document to be able to Sign agents to run on behalf of someone else. The agent is supposed to refresh the group of documents (code at bottom) but instead gives me the errorNotes error: You cannot update or deleted the document(s)since you are not listed as an allowable Author for this document. The Run on behalf of ID is listed in the authors field via a group.

I was under the impression the the Run on behalf of would get around this?

Sub Initialize

Set s = New notesSession

Set db = s.currentDatabase

Set docs = db.search({form = “ISSR”}, Nothing, 0)

Set doc = docs.getFirstDocument

Do While Not doc Is Nothing

Call doc.computeWithForm(False, False)

Call doc.save(False, False) 'ERROR HERE

Set doc = docs.getNextDocument(doc)

Loop

End Sub

Subject: authors fields & run on behalf of agent

Cople of quick thoughts/questions:

  1. Why are you using a group name instead of a user role in the field?

  2. What are you using doc.computewithform for?

Subject: RE: authors fields & run on behalf of agent

Hi File Save -1. I always use that group in my authors fields as a safety. But actually the group is also assigned a role which is also in the field. Overkill I know.

  1. The computeWithForm I am using to refresh db lookups in the readers field.

Basically there is a keywords document in a database and editors of the keywords document can add people into a names field. Upon saving this document I wanted to trigger a refresh of the other documents in the db to update the readers. And now that I’ve written this I realize that I should just create a group that they can update. (*these are problems I run into as a solo developer, difficulty reflecting, thanks for your time)

Thanks!

But still - why didn’t it work???

Subject: RE: authors fields & run on behalf of agent

Computewithform will *NOT" run dblookups.

Subject: RE: authors fields & run on behalf of agent

some would disagree

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/ba9fc07fa7167f6285256f0b00735dcf?OpenDocument

anyway that is not where the agent is failing.

Thanks!

Subject: RE: authors fields & run on behalf of agent

Andre and I have been known to disagree, but he is wrong in this case (until he physically shows me that I and others are wrong on this topic). It does ot matter what the “documentation” says, computewithform will NOT (m my experience as well as others) execute dblookups.

Did you try taking out the computewithform to see if it made any differences?

Subject: RE: authors fields & run on behalf of agent

I’ve not found ComputeWithForm to be 100% reliable, despite what IBM/Lotus might say.

I don’t know hom many technotes I’ve read that say something should be and it’s not (due to new releases, regression errors, environment, whatever). Sometimes, exploration and experimentation will do a lot more for you then reading technotes. (Not trying to gang up on Andre or anything :slight_smile:

Subject: RE: authors fields & run on behalf of agent

Thanks for your input.

It’s failing on the Save. I tried running it with the id that it’s assigned to Run on behalf of and it worked perfectly.

Just as a test I did try removing the computeWithForm and it ran with the same results. The ID that the agent was supposed to Run on behalf of could run the agent fine. Any other id that didn’t have author access to the documents failed.

?

Subject: RE: authors fields & run on behalf of agent

Hi all, I am facing a similar issue and came across your discussion while doing a google search.

My requirement:-

I have a mailinfo field in my document, which keeps a log of users sending a copy of the document to an email-id. I have an authors field on the document. Now, even if a user is not in the authors list, but sends a copy of the document to an email-id, it should be logged in the mailinfo field.

For this purpose, I wrote an agent with “Run on Behalf Of” set as a user(who is in the Authors field), and from the user event, I am calling this agent to update the mailinfo field. But, when the user triggers the event, an error is logged saying that the user doesn’t have access to update the document since he is not in the authors field.

I looked up the help and found that I have to update the Server Document on the domino server to set the properties - “Sign agents to run on behalf of someone else” and “Sign agents to run on behalf of the invoker of the agent”. I couldn’t try out these options because I don’t have administrative rights.

Did you guys figure out a solution for your problem? Please let me know.

Thanks,

Mani.

Subject: RE: authors fields & run on behalf of agent

The place to find the explanation of the difference is in the Agent FAQ “decoding ND6 agents”. It goes over different security levels.

Subject: authors fields & run on behalf of agent

I always prefer to check “Run as web user” instead of run on behalf.

Thanks

Nidhish

Subject: RE: authors fields & run on behalf of agent

  1. This is a client application, not web (she did not state this but it makes sense as she is using QuerySave).

  2. “Run as web user” may present a security risk.

Subject: RE: authors fields & run on behalf of agent

What security risk does “Run as web user” present?

Subject: authors fields & run on behalf of agent

Hi Sally

I know its a little bit late, but I was searching for a similar problem and found the solution: Run on behalf of does not support groups or roles, only single users. So, you have to use the ID which is named in the server document to be able to Sign agents to run on behalf of someone else.

By the way, ComputeWithForm DOES update lookup fields, I used this a thousand times, and it works.

Subject: RE: authors fields & run on behalf of agent

I hate to muddy the discussion on ComputeWithForm, but it is my experience that ComputeWithForm will run formulas in the Value and Default Value events for fields only if that field doesn’t already exist on the backend document. Basically, we’ll use ComputeWithForm to populate a document’s initial field values using the form field’s default values. What we’ve never had any luck with was trying to use ComputeWithForm to recalculate a document based on the computed fields formulas of a form.

Subject: RE: authors fields & run on behalf of agent

Of course “ComputeWithForms” does not reset fields that are not computed, but are editable with a default value. I spoke about computed fields, and they definitively get updated with “ComputeWithForms”.