Support Topics Documentation Slack YouTube Blog

Unable to update records


(Kam Rezvani) #1

Hi,

I am unable to update userStatus field in the Users list for the Traffic_Ticket_Lawyer account. When I change the status from EMAIL-CONFIRMATION to ENABLED it shows that it updated the field but when I return to the Users list the change does not show as committed and reverts to the EMAIL_CONFIRMATION state.

Thanks


(Anton Govorushkin) #2

Hello Kam Rezvani

As far as I understood you’ve turned on Require Email Confirmation, and trying to change the userStatus to enabled. I’ve tried to change it manually in developers console and succeeded. After the switch user was able to login successfully.

Could you please specify are you using Backendless 3 or 4? And in what way are you trying to change the value for the userStatus column?
Also provide your appId.

Regards Anton


(Kam Rezvani) #3

Hi Anton,

Yes, I am trying to change the value of userStatus and am using Backendless 3. I have performed this operation successfully in the past. This is the first time the change does not save. Make sure after you change a record that you recheck that same record to see if the operation was successful.

Thanks


(Anton Govorushkin) #4

Kam, please specify HOW are you changing the status? Manually in the developers console? Or executing REST request or else? And provide your application-id.

http://support.backendless.com/public/attachments/87f3d30c8bcddc7ca6fbf91a68036ace.png</img>

Regards Anton


(Kam Rezvani) #5

Hi Anton,

I was missing the second step. Not used inline changes being a 2-step process. Try to remember that for future changes.

Thanks.


(Anton Govorushkin) #6

There is no necessity in second step in Backendless 4. Changes are being saved right away

Regards Anton


(Marcio Prudencio) #7

Hi guys, I’m finishing a termination process (mandatory in EU) and I can’t update the field (userStatus) in Users back to DISABLED. (If not blocked some users may complain about not removing the account) I got success, no error but the field does not update. *Also tried false and I’m using social login. Regards

AppID: 9CA9AA41-6892-4A1E-FFB5-95DEAF5A4A00

const urlToUpdate = /data/Users/${this.props.userId};
Axios({
url: urlToUpdate,
method: ‘put’,
baseURL: ${metrics.dbConnect},
headers: { ‘Content-Type’: ‘application/json’ },
data: {
userStatus: ‘DISABLED’, // false
}
})


(Mark Piller) #8

Hi @MARCIO_PRUDENCIO,

The userStatus property is handled at the system level and cannot be updated with the API, it can be managed only in console. As a workaround, you could do the following:

  1. Create you own boolean property which represents the user status, for example isEnabled.
  2. Create a beforeLogin event handler in Cloud Code and check the isEnabled column. If the user is disabled, do not allow the login to go through.

Hope this helps.

Regards,
Mark


(Marcio Prudencio) #9

Got it, thanks @mark-piller.