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
samsonsamson 

Help! Weird update problem. Please advise!

I want to update a customized field of Case. (IsCommentMigrated  is a checkbox field whose default value is "false".)
Following is the code:
 *********************Section one ****************************
                Case newCase = new Case();
                newCase.Id = "XXXXXXXXXXX";
                newCase.IsCommentMigrated__c = false;
                newCase.IsCommentMigrated__cSpecified = false;
                try
                {
                    SaveResult[] srArray1 = binding.update(new sObject[] { newCase });
                }
*********************Section two****************************
                Case newCase = new Case();
                newCase.Id = "XXXXXXXXXXX";
                newCase.IsCommentMigrated__c =
true
;
                newCase.IsCommentMigrated__cSpecified =
true
;
                try
                {
                    SaveResult[] srArray1 = binding.update(new sObject[] { newCase });
                }
 
Section one failed, but Section two works! Any one have idea on that? Please advise,thanks!
 
 
SuperfellSuperfell
setting the xxSpecified flag to false means its not sent over the wire, therefore the salesforce server never sees that you want to change that xx value. You should always set the Specified flag to true, regardless of the value you are trying to set the actual field to.
samsonsamson
Thanks a million! It works!