Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Java Development
- :
- Javascript in custom button error with custom obje...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Javascript in custom button error with custom object: "sObject type not supported"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-05-2012 05:21 PM
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.
Director, Product Management
Fusion Risk Management, Inc.
srichardson@fusionrm.com

