Slaesforce FAQ

how insert contact view using trigger in salesforce

by Dr. Gisselle Leffler Sr. Published 2 years ago Updated 2 years ago
image

Trigger accountinsertautomaticallycontactalsoinsert on Account (After Insert) { List<Contact> conlst = new List<Contact> (); For (Account acc:Trigger.New) { Contact con = New Contact (); con.lastname = acc.name; con.accountid=acc.id; conlst.add (con); } insert conlst; } Share Improve this answer edited Oct 23, 2020 at 10:54

Full Answer

What is trigger in Salesforce?

A Trigger is a segment of Apex code which executes before or after inserting or modifying a Salesforce record based on the condition provided. There are different types of triggers based on the action going to be performed. They are Before Triggers and After Triggers. Triggers allow modification of another record of the same type or different type.

What is the primary role of triggers in Salesforce?

As you can see, the primary role of triggers is to automate your data management and workflow in Salesforce. Triggers enable you to perform custom actions (for example, update an account) before or after changes to Salesforce records. But what if you’d like to set similar triggers on incoming and outgoing emails? As a competent, busy Salesforce user, you probably enabled Einstein Activity Capture to auto-log your emails from Outlook or Gmail to Salesforce, only to realize that Einstein Activity Capture and Apex Email Message/Task triggers do not work together.

What is an Apex trigger?

Apex triggers within Salesforce are designed to help you automate certain tasks. Apex triggers allow you to perform custom actions before and after events in Salesforce. These events can include things such as data insertions, updates to existing data, or deletions.

What is a trigger in a contact?

The simplest example of a trigger is a trigger on contact which will create a new Account record whenever a contact is created without an account.

Why set up triggers on task reminders?

Set up triggers on task reminders so you don’t forget anything important.

Can triggers handle multiple records at once?

That is a default setting. They are able to process multiple different records simultaneously. Both triggers can handle single or bulk operations including data Imports, bulk API calls, and bulk actions.

Can Apex triggers be used automatically?

This can be done automatically using Apex triggers.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9