One of the actions in PlayStream is Execute CloudScript. Is it possible to pass some arguments to the function (FunctionParameter in requests from client)?
One of the actions in PlayStream is Execute CloudScript. Is it possible to pass some arguments to the function (FunctionParameter in requests from client)?
Yes, there are two mechanisms to get arguments into your Cloud Script, based upon how it is launched. For regular, client calls to ExecuteCloudScript, you can of course just use FunctionParameter, and those parameters will show up in the args. There are examples showing how to do this in our Samples repo in GitHub, here: https://github.com/PlayFab/PlayFab-Samples
For PlayStream, the event itself is passed into the Cloud Script, so that you can use any parameters from it for your logic. In your Cloud Script handler, make sure to use both the args and context inputs like so:
handlers.onSomeAction = function (args, context)
When a handler is triggered via PlayStream, the inputs will all be in the Context. This includes a playerProfile object, which contains all the info on the player that triggered the call (the PlayFabId, Statistics, LinkedAccounts, etc.), but in addition, it also contains a playStreamEvent object, which is specifically the event that triggered the handler to run.
I think I didn't stress enough that I was writing about PlayStream Action.
1 Person is following this question.