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
IZavalunIZavalun 

PLEASE HELP!!!

Please help…

Instead of coming to this url ‘/a0F60000000HbP0’ I am coming to the home page.

Please let me know how I need to modify my s-control .

 

Here is the code:

 

 

var o = new sforce.SObject('WS__c');

o.set('Svc__c', _owner);

o.set('Welder__c', _num_id);

o.set('Dist__c', _dis_id);

o.set('City__c', _city);

o.set('State__c', _state);

o.set('WMake__c', _make);

o.set('WldMd__c', _model);

var results = sforce.connection.create([o]);

var locationString = '/' + results[0].id + '/e';

window.parent.parent.location.href = locationString;

cheenathcheenath
Try alert(results) after the create call. See if the server returned
any error message during the create call.

HTHs,



BritishBoyinDCBritishBoyinDC
Agreed - worthing including try something like this to catch the error

if (result[0].getBoolean("success")) {
//do success code
} else {
alert("failed to create " + result[0]);
}
sfdcfoxsfdcfox
The results object has an array called "records"; you need to use this array. Try this:

Code:
locationString = null
if(results.getInt('size')>=1&&results.getArray('records')[0].getBoolean('success'))
  locationString = '/' + results.getArray('records')[0].Id + '/e'
if(locationString)
  window.top.location.href=locationString
else
  alert('There was an error!')
Hope this helps!

~ sfdcfox ~

IZavalunIZavalun
Thanks a lot.
It working now