+ Start a Discussion
srichardsonsrichardson 

Javascript in custom button error with custom object: "sObject type not supported"

I have a custom button on a related list with Javascript that is intended to update a checkbox field on all records selected in the related list.

The object is a custom object from a managed package. The custom object API name is FF__Team_Member__c.

The button code:

 

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit 

var records = {!GETRECORDIDS($ObjectType.FF__Team_Member__c)}; //grabs the Team Members records that the user is requesting to update from the selected records in the related list 
var updateRecords = []; //array for holding records that this code will ultimately update 

if (records[0] == null) { //if the button was clicked but there was no record selected 
alert("Please select at least one record to update."); //alert the user that they didn't make a selection 
} else { //otherwise, there was a record selection 
for (var a=0; a<records.length; a++) { //for all records 
var update_TeamMember = new sforce.SObject("FF__Team_Member__c"); //create a new sObject for storing updated record details 
update_TeamMember.Id = records[a]; //set the Id of the selected Team Member record 
update_TeamMember.Send_Email_to_Team_Member__c = "true"; //set the value to true 
updateRecords.push(update_TeamMember); //add the updated record to our array 
} 

result = sforce.connection.update(updateRecords); //push the updated records back to Salesforce 

for(var i = 0; i < result.length; ++i){ 
  if (result[i].getBoolean("success")) { 
          console.log("record with id " + result[i].id + " updated"); 
} else { 
          console.log("failed to update record " + result[i]); 
  } 
} 

location.reload(true); 
}



I receive the following error in the Javascript console in Google Chrome:
failed to update record {errors:{fields:null, message:'sObject type 'FF__Team_Member__c' 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.', statusCode:'INVALID_TYPE', }, id:null, success:'false', }

I have confirmed the object name (API name) is correct.

Thank you for your assistance.  Partner support will not support the case request because Javascript is unsupported. I contest that the JS is not the problem though, IMHO.