Set User Properties¶
Description¶
Before updating the BackendlessUser
object you must set new values or new properties locally in the application using the operation described in this topic. Then you have to use the Update User Object operation to send the locally saved data to Backendless servers to update the Users
data table.
Important
When setting or updating a user property, the values must be of "primitive" data types (boolean, string, number, date). To assign a non-primitive value, use the Data relation API .
When registering a new user, the methods below can be used on the new BackendlessUser
object. When updating an existing user, the BackendlessUser
object representing the user must be retrieved from the server (either via login or the data object retrieval APIs).
Method¶
var user = new Backendless.User();
user[ "YourPropertyName" ] = "YourValue"
Return Value¶
None.
Example¶
The example below sets a new value "342-821-3802"
for the property "phoneNumber"
locally in the application.
If this property is new and does not exist in the Users
data table, then upon the update operation a new column is created with the specified value. This behavior is available only if the Dynamic Schema Definition option is activated.
var user = new Backendless.User();
user[ "phoneNumber" ] = "342-821-3802"