Can I call a shared action via a formula?

Posted on 2009-04-15
Medium Priority
Last Modified: 2013-12-18
Currently my lotus script is in querysave. The form has several action buttons that include a filesave, which calls querysave and so executes my code twice (once via the button and again on exiting the doc). This means msgboxes come up twice, etc.

I was thinking about pulling it out of querysave into a shared action or agent. It's a nuisance problem and not worth spending a ton of time on.

My impression is that I can't call a shared action via the formula language, so I have been looking at an agent. Can I just import my script functions into an agent and call it from within the action buttons on the form? Currently all my notes attributes are declared in querysave, will that "port" over to an agent? Or would I have to recode all that?

Question by:BillTr
1 Comment
LVL 22

Accepted Solution

Bill-Hanson earned 2000 total points
ID: 24152088
First a word of warning...

If you want to ensure that a piece of code is executed when a document is saved, it needs to be placed in QuerySave or PostSave.  In other words, Save actions can be bypassed by using the menu "File \ Save", keyboard (CTRL-S), etc...

That said, sure, you can normally paste action code directly into the Initialize event of an agent.  Set the agent trigger to "Agent list selection" and the target to "None".  In your code get a handle to the current form using NotesUIWorkspace.CurrentDocument.

Regarding whether your QuerySave code will port over, it's hard to say.  It normally will, especially if you define the NotesUIWorkspace.CurrentDocument as 'Source'.  Remember, however, that you will loose the ability to prevent a save.  The Continue argument cannot be modified by an agent, only directly in QuerySave.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

850 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