Antonio Anchondo
Antonio Anchondo

Reputation: 64

Do you need to save ParseUser before Cloud Function Calls?

I have an app on unity that uses ParseUser to store the user Level and Experience. When the user reaches a new Level a ParseCloud function call is made. However whenever user is retrieved via:

Parse.Cloud.define("LevelUp", function (request, response){ var user = request.user; });

All the attributes in user have the values that are currently saved on the database, but not the ones that the ParseUser that made the request have in the Parse client.

Do I need to call ParseUser.CurrentUser.SaveAsync(); before every call to the server to get current user values or is there a way to send the dirty ParseUser values to the ParseCloud function and update them from that function.

Thanks!

Upvotes: 1

Views: 65

Answers (1)

Antonio Anchondo
Antonio Anchondo

Reputation: 64

Short answer yes.

Long answer: Not necessarily, but you need to wrap the unsaved (or dirty) attributes in an object and send it to ParseCloud, due the fact that you can't send ParseObject in a ParseCloud call.

In my case, I ended up changing the approach: retrieve the necessary information about the level, and do the modifications on the ParseUser on the client.

Upvotes: 1

Related Questions