function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Koen (BvD)Koen (BvD) 

update custom object / field gets undone

I have a strange problem when updating a a custom object / field. During the load of the page I check via a webservice some info and update if necessary. I use the very standard way of retreiving the object, changing something and updating it

 

        bvdep__BvD_Installed_Products__c checkInstall =  
                   [select Name, bvdep__Product_URL__c from bvdep__BvD_Installed_Products__c
                    where bvdep__Id__c = :details.ProductId LIMIT 1];

         checkInstall.bvdep__Product_URL__c = details.Url;

         Database.SaveResult SR = database.update (checkinstall);
         if (SR.isSuccess ())
               // report success

 I added all kind of trace messages, and I can see that the new value is on the object and that the isSuccess returns true, however the object is not updated. It is not a problem of security as the same code is able to insert new objects (so access to all fields is ok).

What is even more strange is that I really have the impression that the update just gets lost. To try the update method I also added the update of the name property that is a standard field. The funny thing is that when the page displays the name is updated (I see the updated name in the left pane of recent items) but as soon as I click on the object it shows up with the old name and the old custom property value.

This would look like a trigger, but there are no triggers on this object.

 

I am quite sure that this exact same code has worked before, and the only change I can remember making is upgrade the version of the code and pages all to the latest version of the api (it was version 16, now verion 26). But I downgraded the version of both page and controller back to 16 and it doesn't work.

 

How can I find where - and most importantly why - the update gets undone?

 

Koen.

Shailesh DeshpandeShailesh Deshpande
Strange. Have you checked if there are any workflow field updates defined for this object?
Koen (BvD)Koen (BvD)

I have never worked with workflows, so I don't even know how to check this but I suppose none are defined unless it can automagically appear.

BTW : this code and the csutom object form part of a managed package and one installation of the package I tested has the same problem.

I also looked at this with the management console with logging at its finest for database operations and I see this update statement, but no other change operations on the record

 

 

Shailesh DeshpandeShailesh Deshpande
You can check by. Navigating to setup - workflow & approvals - field updates.

I think you can also check by clicking on your package name and checking the package components.
Koen (BvD)Koen (BvD)

as expected this is empty. Never used this before.