I have been googling this for a sustained period of time and all the suggestions and solutions I have encountered are still not working.
Ultimate goal: a User clicking a button will write an incremented number value to an existing custom field on the same object and then update that sobject record.
Goal for now: just getting an existing field value to be read by the stupid alert.
Dialog error box:
An Error has Occurred. Error: sObject type 'sObject' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Code:
{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")}
var mpArray = [];
try{
var updateMP = new sforce.SObject("Media_Placement__c");
updateMP.id = "{!Media_Placement__c.Id}";
var newNumber = Number(0);
alert(updateMP.Advertiser__c);
alert(newNumber);
mpArray.push(updateMP)
//alert(updateMediaPlacement.Media_Placement__c.Incorrect_Name_Count__c)
result = sforce.connection.update([mpArray]);
if(result[0].success == "true"){
location.reload();
}
else{
alert(
"An Error has Occurred. Error: \r\n" +
result[0].errors.message
);
}
}
catch(e){
alert(
"An Un-expected Error has Occurred. Error: \r\n" +
e
);
}