My GenerateReport client function calls the needed server function StageReportServer asynchronously and if successful, in the client callback calls five.selectAction( reportID, { UserKey: userKey, RunKey: runKey } );
This is working fine for the on-demand reports. But for my automated emails with attached reports functionality, I’m having an issue. The client GenerateEmails function calls the GenerateEmailsServer function. That server function also needs to call StageReportServer. This time, I’m calling synchronously like this:
const stageResult = StageReportServer(five, parms, {});
But this time, I get
Error during "generating reports": StageReportServer is not defined
ChatGPT says something about different scope, and the server function can’t see the other server function unless it’s contained in the same JavaScript function.
Can you please advise the proper way to do this, so a server function is visible from both client and another server function? I believe Libraries won’t work, because I think they are callable from client functions, not server functions. but please correct me if I’m wrong.
I notice that the Libraries tab is visible in the function screen, even in a server function, but am unsure how to use this from a server function.
Thanks…