How can I create a context for a client-side function

Is there a way to trigger a client-side function from an event on a form, but first load a context for it?

I have a function called from an OnShow event for a form. It uses several field values to build a context then execute a server-side function using that context.

But I also need to call the server-side function from a process to help automate emailing my reports. I need a context for this server-side function, but it will not be created by a form event calling a client-side function.

So I need the same context to be built from the process AND from a particular form, before either executes the server-side function.

I guess I have the option of setting a bunch of variables instead??

I prefer a context object because it’s easier to build, and doesn’t need to be deleted or disposed of, right?

I have yet to figure out how to build the context when initiating the mail-merge process, but that is not so important. The context is being built fine from the form itself. But I tried to accomplish economizing on functions having one function call another client-side function which would then call the server side function. That causes an error for some reason.

Can you help with the process by advising if I can build a context object client-side then have it run another client-side function, or must it only run a server-side function? Sorry for verbosity.

You might want to check out the executeAction() function. It lets you trigger a server-side action from the client side, which sounds like what you’re trying to achieve. Currently supported actions are Mail Merges, Processes, and Reports.

If you want to call a server-side function instead, you can refer to executeFunction().

Thanks for answering but I figured this out and flagged this post for deletion because I figured out the solution myself?