+ Start a Discussion
james12344321james12344321 

create a basic custom sobject from a custom button

Hi,

 

  I have a basic new sobject as an example called essay__c with one field called name__c.

 

I'd like to have a custom button on the accounts tab that when pressed creates a new essay record. I'm trying thew following code in the button but it doesn't work:

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var t1= new sforce.SObject("essay__c "); t1.name__c = "jim";

var result = sforce.connection.create([t1]);

 

It's probably something really stupid. Does anyone know why please?

 

Thanks,

James.

NaishadhNaishadh

What are you getting in reponse? try to use callback method.

james12344321james12344321

Hi,

 The error is:

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'essay__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.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'essay__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.', row:'-1', column:'-1', }, }, }

chidevchidev

Make sure you're using the correct API name for your custom object.  That's the first thing to check.

Imran MohammedImran Mohammed

Is your development org having a namespace and is your application a Managed Package?

James SwansonJames Swanson
You could use https://www.bestessays.com/write-my-research-paper.php service to get help with your project. Feel free to do that next time.
Jason VooJason Voo
Good morning James Swanson! It is very interesting suggestion on this post and thanks for sharing it! Today almost every learner has his favorite writing agency, but some of them are really scammers. That's why it is important to find most authentic writing company, where you can order tasks online and various types of writing, whether it's coursework, essay, dissertation or any others you need to. So, I've found an outstanding online paper writer (https://www.masterpapers.com/) agency for myself, simply check their website!