Problem: You need to create an apex trigger on the contact object which is fire whenever a new contact is created or updated and show the default description accordingly Trigger code : Output : Create a contact and check description is blank or not then hit save When contact is inserted description will be ”Continue reading “Update description in contact object whenever a new contact is created or updated”
Tag Archives: salesforce apex trigger best practices pdf
Throw Error when user tries to delete the contact without account
Problem: You need to create an apex trigger on the contact object which is throwing an error whenever user tries to delete the contact without an account Trigger code : Check the error : Create a contact without selecting a account and hit save Which is look like this Now try to delete that account.Continue reading “Throw Error when user tries to delete the contact without account”
View post to subscribe to site newsletter.
Change the beginning of the product code whenever we insert a new product
Problem: You need to create a trigger on the product object which fires every time we insert a new product, we want to make sure that we will add XYZ at the beginning of that product code. Trigger code : Check our trigger : Create a new product and give product code as V305001 andContinue reading “Change the beginning of the product code whenever we insert a new product”
View post to subscribe to site newsletter.
Opportunity Checkbox isValueCorrect Salesforce Apex Trigger
Problem: Create a custom checkbox field on the opportunity (label: IsValueCorrect)If the stage updated to closed-won only the IsValueCorrect check box is checked Trigger code : Check our trigger : Create a opportunity record and chose stage as qualification and hit save Then update the same record stage as closed Won so ‘Is_value_correct’ check-box willContinue reading “Opportunity Checkbox isValueCorrect Salesforce Apex Trigger”
View post to subscribe to site newsletter.
Sending email from apex trigger
Problem: You need to create an apex trigger on contact object which send email when contact will inserted. Trigger code : Check our trigger : Create a new contact record with email address and hit save After your contact will save you receive a mail like this Was this blog is useful?
View post to subscribe to site newsletter.