Good Day,
I have a form that allows a “owner” user to create, update and delete other user accounts.
Using codeless logic I am able to add users (using Cloud Code) and delete users. When it comes to updating the user I display all the Users information but not the password. When I click the Update button I receive the following error “Something went wrong. Error: Property ‘password’ is required”.
I am using the “Save to backendless” block which will save the data on the page to the “Users” table.
Will I need to use Cloud Code to update the User or is there another way around this?
Kind Regards
Donovan
Hello @Donovan_Hardwick
Try using the following block to update the user. Monosnap
Regards,
Inna
Hi @Inna_Shkolnaya
Thank you for the assistance.
I am getting the following error “Server returned: Error: Could not find user by id or identity”, so I tried the following but is still doesn’t work.
- Property id of page data is the users objectId.
- Property displayUser of Page data is the form where all the users data is stored.
Kind Regards
Donovan
@Donovan_Hardwick
Did you set user data (“id” and “displayUser”) to “Page Data” beforehand?
Regards
@Inna_Shkolnaya
Yes, the objectId is set as the id on the previous page when the “Update” button is clicked. The displayUser property is set on page enter, whereby the details are retrieved and stored in a variable and in return stored in the displayUser property.
App ID: 56447795-182A-D679-FF9E-05029343F800
Page: staffUpdate
The logic is in the create-form component.
Hello @Donovan_Hardwick
Using the Create Object
you create a new object with the following properties
But the Update User
block requires an instance of User where should at least the following property
That’s the reason why you receive this error: Server returned: Error: Could not find user by id or identity
Thank you @vladimir-upirov and @Inna_Shkolnaya
It works!!!
Just one question. Let’s say the “User” table has two schema “nameUser” and “company”, the “company” column is a relation to the Company table that has one schema called “nameCompany”. Now both “nameUser” and “name Workshop” needs to be updated. How do I update the related table information?
I have tried to use the below logic but it does not work, is there a better way to update the related table?
Kind Regards
Donovan
Hi Donovan,
Not a big deal, I got what you’re talking about, but to add some clarity, the term “schema” is used to identify the structure of a table (or sometimes the entire database). When you refer to a specific property/column, it would be better to use the term “column”.
In your example below:
what is “name Workshop” ? Is it a column for a related table? What specifically needs to be updated? A property in the related table or the actual related object?
Regards,
Mark
Good Day @mark-piller
Thank you for the clarity.
Please ignore the “name Workshop” in my previous message, this should be “nameCompany”.
The User table has a Company table related to it, so I would like to update both the “nameUser” (Text) and “company” (relation to Company table – “nameCompany”(Text) column) columns. So the user will be able to update both the “nameUser” and the “nameCompany” columns after clicking the save button.
Kind Regards
Donovan