Skip to content

Instantly share code, notes, and snippets.

@TheShubhamVsnv
Created March 7, 2024 06:33
Show Gist options
  • Save TheShubhamVsnv/fe6c2a9851f79ad57139e3ba20465cd8 to your computer and use it in GitHub Desktop.
Save TheShubhamVsnv/fe6c2a9851f79ad57139e3ba20465cd8 to your computer and use it in GitHub Desktop.
//Define the HTTP POST method to create contact
@HttpPost
global static Contact createContact(String contactFirstName, String contactLastName) {
Contact con = new Contact(
FirstName = contactFirstName,
LastName = contactLastName
);
try {
insert con;
} catch (Exception e) {
// Handle exception during contact creation or sending
System.debug('Error: ' + e.getMessage());
}
return con;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment