You need to sign in to do that
Don't have an account?
DEV SFDC
Insert records using java script detail page button
Hi there,
My requirement is that we have a Custom Detail Page button on Opportunity , when we click on the button it should create a new record on Custom object. Here is the code snippet that i worked with but when we clicked on the button it is smiply showing error that " A PROBLEM WITH THE ONCLICK JAVASCRIPT BUTTON OR LINK :{fault code: Invalid_Type,SObject Type abc__c is not supported. Be sure to append __c if you are using custom object.
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js" )}
var connection = sforce.connection;
var ab= new sforce.SObject("abc__c");
ab.Opportunity__c='{!Opportunity.Id}';
sforce.connection.create([ab]);
Any help would be much appreciated.
Many Thanks
My requirement is that we have a Custom Detail Page button on Opportunity , when we click on the button it should create a new record on Custom object. Here is the code snippet that i worked with but when we clicked on the button it is smiply showing error that " A PROBLEM WITH THE ONCLICK JAVASCRIPT BUTTON OR LINK :{fault code: Invalid_Type,SObject Type abc__c is not supported. Be sure to append __c if you are using custom object.
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js" )}
var connection = sforce.connection;
var ab= new sforce.SObject("abc__c");
ab.Opportunity__c='{!Opportunity.Id}';
sforce.connection.create([ab]);
Any help would be much appreciated.
Many Thanks
1. The custom object does not exist or is defined incorrectly like missing underscore('_'), However, I see that you gave double underscore to represent the custom object correctly.
2. CRUD permissions not available for this user on custom object. Despite being a system administrator, sometimes you may not have the create permission on the custom object. Please make sure that you have the custom object permissions which should resolve the problem. Reference ; http://foxsys.blogspot.in/2013/04/sales-force-custom-object-permissions.html
Please mark this as the best answer if this resolved your issue.
Thanks for the reply.
CRUD Permissions are available on the custom object but still it didn't worked.
thanks for the reply and i got the answer.
The reason being the error is i have name space in my org and need to add name space as prefix.