Skip to content

Instantly share code, notes, and snippets.

@TheShubhamVsnv
Created June 30, 2021 12:42
Show Gist options
  • Save TheShubhamVsnv/6a6725f33395fce2ad80788f40e13688 to your computer and use it in GitHub Desktop.
Save TheShubhamVsnv/6a6725f33395fce2ad80788f40e13688 to your computer and use it in GitHub Desktop.
<!-- wp:paragraph --> <p>When a new Account is created, create a new Contact that has the following data points:</p> <!-- /wp:paragraph --> <!-- wp:list --> <ul><li>First Name = “Info”</li><li>Last Name = “Default”</li><li>Email = “info@websitedomain.tld”</li><li>Only_Default_Contact = TRUE</li></ul> <!-- /wp:list --> <!-- wp:paragraph --> <p>Wh…
trigger defaultContact on account(after insert)
{
Account acc = [select id,Only_Default_Contact from account where id in : trigger.new];
contact con = new contact();
con.firstName = 'Info';
con.LastName = 'Default';
con.email = 'info@websitedomain.tld';
con.accountId = acc.id;
insert con;
//If you want to make checkbox true then use this also-
acc.Only_Default_Contact = true;
update acc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment