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
AhlomonAhlomon 

If the field is greater than '999' then returns error. Please advise...

If the field (below in red) is greater than '999', for example '1,357' then returns error. The field defined as number (8,0) in the object.
If the field is less than 1,000 then it works.
 
Please help me to understand this problem.
==============================================================
 
var o = new sforce.SObject('IS_Machine_Make_Model__c');
          o.set('Machine_Make__c', mach_make);
          o.set('Machine_Model__c', mach_model);
          o.set('Feet__c', blade_feet);
          o.set('Inches__c', blade_inches);
          o.set('Name', is_make_model);
          o.set('Blade_Width_Common__c', blade_width);
          o.set('Blade_Gauge__c', blade_gauge);
          o.set('Orientation__c', orientation);
          o.set('Feed_System__c', feed_system);
          o.set('Blade_Length_mm__c', blade_length_mm);
          o.set('Blade_Gauge_mm__c', blade_gauge_mm);
          o.set('Blade_Width_mm__c', blade_width_mm);
          var results = sforce.connection.create([o]);
          var locationString = '/' + results[0].id + '/e';
          locationString += '?retURL=%2F' + results[0].id;
werewolfwerewolf
Are you actually putting commas in the number you're trying to submit?  That would screw it up.  Try 1357 instead of 1,357.
AhlomonAhlomon

I am not putting the commas, when it saved from edit mode to detail mode it puts the comas because the field defined as number(8,0)

Any idea how I can solve this problem?

werewolfwerewolf
Well there's surely some issue in the code or with that variable or field.  Do you have a validation rule on the field that prevents values higher than 1000?  Did you run it with Firebug and debug at that line to see what the value of the variable is exactly?
AhlomonAhlomon

There is NO validation rules, no I didn't run it in debug, but the value shows for example '1,357' and you are right as soon as it sees the comma it errors on this line ==> var results = sforce.connection.create([o]);

 

I am still not shure why what to do here

werewolfwerewolf
no I didn't run it in debug

Why not?  It could provide a crucial clue.
AhlomonAhlomon
honestly, I don't familiar with Firebug, and don't know haw to run it
werewolfwerewolf
Actually I was referring to the debug log in salesforce -- Setup->Monitoring->Debug Logs.  But honestly, if you're going to be writing Javascript you really should familiarize yourself with Firebug, otherwise you're just blindly banging your head against the wall.
AhlomonAhlomon

I did try debug...

Unfortunatelly, there is no way I can track S-Controls in Debug, so it was just empty after I did set it up

werewolfwerewolf
It's not the Scontrol you're tracking in the debug log, it's the API transaction.
werewolfwerewolf
Anyway if you used Firebug you'd be able to dig into the specific error the API is throwing at you, which will probably tell you exactly how to fix it.
AhlomonAhlomon
where I can get the Firebug? Is it available on SF for download?
werewolfwerewolf
Firebug is not a Salesforce.com product, it's a Javascript debugging plugin for Firefox.  Come on, man, you have Google too.  https://addons.mozilla.org/en-US/firefox/addon/1843
AhlomonAhlomon
Thank you I will try it