<Edited my first response, For some reason, I initially read this purely as a data storage question>
As your post already mentions, for data storage you should omit the "client" and simply use the $db.get method. However, you should have stored the required information first using $db.set, which is why you are getting the "Record not found" error. You can refer to the following sample - https://github.com/freshdesk/marketplace-sample-apps/blob/master/Freshdesk/v2/scheduled_events_sample_app/server/server.js
However, I see you are trying to get the currently logged in agent which is not automatically available for serverless apps. Could you elaborate on the app's use case? We may be able to suggest an alternate way of obtaining this information.
There are two elements of the requirement:
1. I was to restrict some of the serverless app's capability based on the role of the agent. i.e. As a administrator I can do more things than a standard agent.
2. I want to include some element of logging in the serverless app's capabilities, and I need to know the agent's name to include the details in the log.
All of these things are possible in the serverless app if it is triggered in response to an event, so why not when handling an invoke function?
Hello David,
When a serverless app is triggered in response to an event, the event payload is automatically passed to it.
When it is invoked from the front end (using Server method invocation), only the iparams are passed automatically. All other data can be passed using the options parameter. For your use case, you can first get the currently logged in user and then pass it as part of this options object.
Let me know if this helps, if not I'll convert this into a ticket and reach out separately.