function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Roma89Roma89 

How do I create a "Create New Contact" button?

Want to create a "New Contact" button that is located directly on the Contact record. Can someone supply me with the code to create a new contact; so I can create the custom button.

 

thanks,

p

Best Answer chosen by Admin (Salesforce Developers) 
Aslam_Kamal_86Aslam_Kamal_86

You can give this URL /003/e?retURL=%2F003%2Fo in the custom button.

Also make sure the Content source is URL for the Custome Button.

All Answers

PragadheeshwariPragadheeshwari

Hai,

  

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

var con= new sforce.SObject("contact"); 

 con.LastName = 'Praga';

resulttrans = sforce.connection.create(con); 

 alert('created');

 window.location.reload();

 

 

Check the above code,Get back to me if you have any doubt.

Aslam_Kamal_86Aslam_Kamal_86

You can give this URL /003/e?retURL=%2F003%2Fo in the custom button.

Also make sure the Content source is URL for the Custome Button.

This was selected as the best answer