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
BtormarBtormar 

Update call in S-control no longer working

We have had an s-control update a parent record with some number values from a child record. It has worked perfectly up until now, but now the fields we are trying to update on the parent record comes up as zero - no matter the actual value of child record fields are.
 
Here's the update call section of the s-control:
var update_oppt = new sforce.SObject('Opportunity');
update_oppt.id = "{!Funnel_Scorecard__c.OpportunityId__c}";
update_oppt.Latest_Funnel_Scorecard_Total__c = totals[0].Total__c;
update_oppt.Latest_Business_Criteria_Subtotal__c = totals[0].Business_Criteria_Subtotal__c;
update_oppt.Latest_Opportunity_Criteria_Subtotal__c = totals[0].Opportunity_Criteria_Subtotal__c;
var save_oppt = sforce.connection.update([update_oppt]);
 
The fields we are trying to update are number fields - if I change these to update text fields, it all of a sudden it works...
 
Considering this has worked for months, and we've made no changes to any configuration - does anyone have an idea as to why this does not work anymore? Any updates or changes Salesforce.com has done perhaps?
 
The number values in the array does show up as 34.0 for example - could it be mistaking this for a text value for some reason? I realize I'm reaching here, but I'm just completely lost as to why this does not work anymore...
 
Any thoughts?
 
Thanks!
werewolfwerewolf
Did you run this through Firebug to see if you get any sort of error on the update call?
CaptainObviousCaptainObvious
"if I change these to update text fields, it all of a sudden it works..."
 
You may be right- the values are probably being mistaken for text fields.
 
Try to force a string-to-number conversion and see if that helps:
 
update_oppt.Latest_Funnel_Scorecard_Total__c = totals[0].Total__c*1;
update_oppt.Latest_Business_Criteria_Subtotal__c = totals[0].Business_Criteria_Subtotal__c*1;
update_oppt.Latest_Opportunity_Criteria_Subtotal__c = totals[0].Opportunity_Criteria_Subtotal__c*1;
BtormarBtormar
Thanks for the suggestion. However, I tried the conversion - unfortunately it did not work...
 
I have not tried Firebug - however, as long as the fields are text it seems to work. Also, the last modified date does update and I have a statement to catch any failure in the save/update call and it does not kick in.
 
Any other suggestions guys?
 
Thanks!
sfdcfoxsfdcfox
Personally, unless you have some really compelling reason, I'd ditch your S-Control and use Apex Code. It's faster, offloads the heavy stuff to the server, and saves you headaches since Apex Code is a strongly typed language, so such nuiances are far easier to detect and control. Other than that, without seeing the entire code and knowing what your fields are like (data types), I'm at a loss on this one...