System column "ownerId" can be updated to null?

Hi,
I came across a situation where my app accidentally updated ownerId to null and it went through. I always assumed that even though I set null to my object’s ownerId property, it will still get the ownerId of the current user. Is this standard behavior?
Regards,
Allen

Please clarify: what platform (Android, iOS, JS, etc) do you use?

Could you provide some code sample which demonstrates this problem?
Also provide your appId here or to support@backendless.com, we will try to reproduce this issue with your data.

It’s an android app. The code I used is shown below.

@Override
protected void onHandleIntent(Intent intent) {
    Setting setting = (Setting) intent.getSerializableExtra(Setting.class.getName());
    if (setting != null) {
        BackendlessCollection<Setting> settingBackendlessCollection = Backendless.Persistence.of(Setting.class).find();
        List<Setting> settingList = settingBackendlessCollection.getData();

        for (Setting s : settingList) {
            if (s.getKey().equals(setting.getKey())) {
                setting.setObjectId(s.getObjectId());
                break;
            }
        }

        Backendless.Persistence.of(Setting.class).save(setting);
    }
}

Setting from intent only has the properties key and value with values. The rest are null/blank.

Regards,
Allen

Hey Allen

Thanks for response. Please provide your application id.

Regards,
Anton

Hi Anton,

Sorry for the late response. Application Id is EF55763A-A2A9-357A-FF5A-ACBD55E65D00.

Regards,
Allen

Allen,

I am looking at your data and see that both Setting objects have assigned ownerId.
http://support.backendless.com/public/attachments/6575e7ae70ef531a2beafbfefc6e971f.jpg</img>

Nevertheless, if you set ownerId to null and update the object in the persistent storage, new ownerId will not be set. It is assigned only for the original creation of the object.

Mark

Hi Mark,

Sorry. Forgot to mention that I deleted the records and re-created them after fixing my code in the android client.

It’s no big deal actually. I was just curious if that was standard behavior. I can probably try to replicate it if necessary.

Regards,
Allen

Hi Mark,

It happened again today. Kindly check on the Expense table, record with objectId 28C419AA-886D-F836-FFAD-90123F544900.

When the record was created, it had a value for ownerId. Then in my android app, I did an update to the totalPrice column. When it got updated, it set the ownerId to null. I tried updating the record many times after to see if the ownerId gets updated with a value. Unfortunately it did not happen.

Regards,
Allen

Hi Mark,

It happened again today. Kindly check on the Expense table, record with objectId 28C419AA-886D-F836-FFAD-90123F544900.

When the record was created, it had a value for ownerId. Then in my android app, I did an update to the totalPrice column. When it got updated, it set the ownerId to null. I tried updating the record many times after to see if the ownerId gets updated with a value. Unfortunately it did not happen.

PS: Sorry for the duplicate post.

Regards,
Allen

ownerId is a regular filed and it is not prohibited to change it. so if you update it to null it would be null.