Skip to content

Instantly share code, notes, and snippets.

@atulgupta31
Created April 30, 2016 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atulgupta31/3291e470a2c131daeb02ea0c7fc51724 to your computer and use it in GitHub Desktop.
Save atulgupta31/3291e470a2c131daeb02ea0c7fc51724 to your computer and use it in GitHub Desktop.
//instantiate a new Contact
Contact con = new Contact();
con.LastName = 'testLastName';
con.Email = 'test101@salesforce.com';
//getch recordtypeId via schema call, recordtype should be referenced by Name and not Developer Name
con.RecordTypeId = Schema.SObjectType.Contact.RecordTypeInfosByName.get('Contact Record Type').RecordTypeId;
Database.insert(con);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment