Pass value from Xpages view button to agent

Greetings, I am trying to pull a value from a document in the xpages view prior to the document being deleted then pass that value into an agent. I have added an action to execute before the delete selected documents action.

Is this possible? If so how?

I am using Onclick, Server, simple actions with Javascript(Server Side) selected.

Thank you

Subject: Re: Pass value from Xpages view button to agent

I’m not sure if either of these options will work or are viable, but because you have not yet received an answer, I’ll offer some thoughts.

You can call NotesAgent.run passing a document’s NoteID (not UNID) as a parameter. The help (probably best to look at LotusScript help) will tell you how to use this. However, one potential issue to be aware of is that your delete function may delete the document before your agent run or completes, so you may get errors.

The other option is using server-side javascript to do whatever is being done in your agent. You’l need to rewrite your lotusscript agent, but the similarities between server-side javascript and lotusscript will hopefully minimise the changes needed. Presuming your agent is also used by Notes Client functionlity, it does have the disadvantage of demanding more in ongoing support, if you need to make changes in the future.

Hope this helps

Paul

Subject: Re: Pass value from Xpages view button to agent

I was thinking the same thing according to information I have red I can do .run(noteid) however when I try this I get an error but if I just try to run the agent I don’t.

As for the second option I’m not sure if its possible to use server side javascript for it. Basically I am using a value to search for another form in the db and change a value on that form. The LS Agent does a document collection, then searches for a form based on field values.

Thanks

Matt

Subject: Re: NotesAgent(NoteId)

Just one thought, because I’ve learnt from my mistake with passing a noteid. NoteID when returned by some methods put the “NT” on the front. For NotesAgent.Run(noteID), the noteID should be without “NT”, e.g. 000020FA. I’m not sure if this will work with a document that has not yet been saved (from what you say, I’m wondering if that’s the case).

You should be able to use server-side javascript to get the values even from a new document, because you have all the properties and methods that there are in back-end lotusscript. If it’s not in a script library but in your page, you can use getComponent(elementID).getValue() to get the relevant values from your front-end form to pass into your search of your NotesDocumentCollection.

If you’ve not come across it, Declan Sciolla-Lynch’s blog is very useful:

http://www.qtzar.com/blogs/qtzar.nsf/htdocs/LearningXPages.htm

And there’s also a course on the Domino Designer wiki which are the modules used in IBM training.

Regards

Paul