

{"id":25340,"date":"2018-09-03T07:36:45","date_gmt":"2018-09-03T07:36:45","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=25340"},"modified":"2018-09-15T12:27:47","modified_gmt":"2018-09-15T06:57:47","slug":"triggers-in-salesforce","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/","title":{"rendered":"Triggers in Salesforce | Types of Triggers and Syntax"},"content":{"rendered":"<h2>1. Triggers in Salesforce Tutorial<\/h2>\n<p><span style=\"font-weight: 400\">Today, in this Triggers in Salesforce tutorial, we are going to learn what is Triggers in Salesforce. Moreover, we will discuss the Apex Trigger, Types of Triggers in Salesforce. Also, we will see Trigger Syntax and Trigger Context Variables in Salesforce. At last, we will<a href=\"https:\/\/data-flair.training\/blogs\/salesforce-tutorial\/\"> <strong>learn Salesforce<\/strong><\/a> Trigger Example.<\/span><\/p>\n<p>So, let&#8217;s start Triggers in Salesforce for beginners.<\/p>\n<div id=\"attachment_25359\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-25359\" class=\"wp-image-25359 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg\" alt=\"Triggers in Salesforce | Types of Triggers and Syntax\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-25359\" class=\"wp-caption-text\">Triggers in Salesforce | Types of Triggers and Syntax<\/p><\/div>\n<h2><span style=\"font-weight: 400\">2. Apex Triggers in Salesforce<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Apex often invokes by using triggers. The function Apex triggers avail you the freedom to perform custom actions before making changes to Salesforce records, like insertions, updates, or deletions.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/salesforce-lightning-tutorial\/\">Have a look at Salesforce Lightning\u00a0<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">A trigger is the Apex code that executes before or after the subsequent kinds of operations:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">insert<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">update<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">merge<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">upsert<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">undelete<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">delete<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\"><strong><em>Example of Triggers in Salesforce<\/em><\/strong>, you&#8217;ll have a trigger run before an object&#8217;s records are inserted into the database, once records are deleted, or perhaps after a record is fixed from the recycle bin.<\/span><br \/>\n<span style=\"font-weight: 400\">To outline a trigger, from the object management settings for the object whose triggers you wish to access, attend Triggers.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/salesforce-data-security\/\">Do you know about Salesforce Data Security Model<\/a><\/strong><\/p>\n<h2><span style=\"font-weight: 400\">3. Types of Triggers in Salesforce<\/span><\/h2>\n<p><span style=\"font-weight: 400\">After triggers are used to access field values that are set by the system (such as a record&#8217;s Id or LastModifiedDate field), and to have an effect on changes in alternative records, like logging into an audit table or firing asynchronous events with a queue. The records that fire the once trigger are read-only.<\/span><br \/>\n<span style=\"font-weight: 400\">Saleforce Triggers may modify alternative records of identical type because the records that originally fired the trigger. As a <strong><em>Salesforce Trigger Example<\/em><\/strong>, if a trigger fires after an update of contact A, the trigger may modify contacts B, C, and D. Hence, Triggers in Salesforce will cause alternative records to change, and since these changes will, in turn, fire additional triggers. The Apex runtime engine considers all such operations one unit of work and sets limits on the amount of operations which will perform to stop the infinite recursion.\u00a0<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/sharing-rules-in-salesforce\/\">Let&#8217;s revise the Salesforce Sharing Rules<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">Additionally, if you update or delete a record in its before trigger, or delete a record in its after trigger, you may receive a runtime error. This includes each direct and indirect operations. For example, if you update account A, and therefore the before update trigger of account A inserts contact B, and therefore the after insert trigger of contact B queries for account A. Updates it mistreatment the DML update statement or database technique, then you&#8217;re indirectly updating account A in its before trigger, and you may receive a runtime error.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">4. Implementing\u00a0the Triggers in Salesforce<\/span><\/h2>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><em>Upsert triggers<\/em> fire each before and once insert or before and after update triggers as applicable.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><em>Merge triggers<\/em> fire each before and after delete for the losing records, and both before and after update triggers for the winning record.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Triggers that execute once a record has been undeleted only work with specific objects.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Field history not records till the top of a trigger.<\/span><\/li>\n<\/ul>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/salesforce-terminologies\/\">Do you know about Top Salesforce Terminologies<\/a><\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Field history tracking provides the liberty or permissions of the current user. If this user doesn\u2019t have permission to directly edit an object or field. However, the user activates a trigger that changes an object or field with history tracking enabled, no history of the change record.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Callouts should be created asynchronously from a trigger so that the trigger method isn\u2019t blocked while looking ahead to the external service&#8217;s response. The asynchronous callout is created in an exceeding background process, and also the response is received once the external service returns it. To form an asynchronous callout, use asynchronous Apex such as a future method.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400\">5. Trigger Context Variable in Salesforce<\/span><\/h2>\n<p><span style=\"font-weight: 400\"><strong>a. isExecuting- <\/strong>Genuine if the current setting for the function Apex code is a trigger, not just a <a href=\"https:\/\/data-flair.training\/blogs\/salesforce-visualforce\/\"><strong>Visualforce page<\/strong><\/a>, a web benefit, or an execute anonymous() API call. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>b. isInsert-<\/strong>\u00a0Genuine if this trigger was eliminated because of an embed activity, from the Salesforce UI, Apex, or the API. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>c. isUpdate-<\/strong> Returns genuine if this trigger was let go because of a refresh task, from the Salesforce UI, Apex, or the API. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>d. isDelete-<\/strong> Genuine if this trigger lets go due to the reason of an erase activity, from the Salesforce user interface, Apex, or the API. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>e. isBefore-<\/strong> Returns genuine if this trigger terminates before any record was spared.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/salesforce-list-controller\/\">Let&#8217;s learn about Salesforce List Controller<\/a><\/strong><\/p>\n<p><strong>f. isAfter<\/strong><span style=\"font-weight: 400\"><strong>&#8211;<\/strong> Returns genuine if this trigger was terminated after all records were spared. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>g. isUndelete-<\/strong> Genuine if this trigger was let go once just after a record is recouped from the Recycle Bin (that is after an undelete task from the Salesforce UI, Apex, or the API.) <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>h. new-<\/strong> Returns a rundown of the new forms of the sObject records. This sObject list is just accessible in the embed, refresh, and undelete triggers, and the records must be changed in before triggers. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>i. newMap-<\/strong>\u00a0A directory of IDs to the new kind of the sObject records. This guide is just accessible in before refresh, after embed, after refresh, and after undelete triggers. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>j. Old-<\/strong> Returns a rundown of the old forms of the sObject records. This sObject list is just accessible in refresh and erases triggers. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>k. oldMap-<\/strong> A guide of IDs to the old renditions of the sObject records. This guide is just accessible in refresh and erases triggers. <\/span><br \/>\n<span style=\"font-weight: 400\"><strong>l. Size-<\/strong> The add up to the number of records in a trigger summon, both old and new.<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/salesforce-automation\/\">Do you know about Salesforce Automation<\/a><\/strong><\/p>\n<p><span style=\"font-weight: 400\">For Example: <\/span><\/p>\n<pre class=\"EnlighterJSRAW\">Trigger simpleTrigger on Account (after insert) {\r\n   for (Account a : Trigger.new) {\r\n       \/\/ Iterate over each sObject\r\n   }\r\n   \/\/ This single query finds every contact that is associated with any of the\r\n   \/\/ triggering accounts. Note that although Trigger.new is a collection of\r\n   \/\/ records, when used as a bind variable in a SOQL query, Apex automatically\r\n   \/\/ transforms the list of records into a list of corresponding Ids.\r\n   Contact[] cons = [SELECT LastName FROM Contact\r\n                     WHERE AccountId IN :Trigger.new];\r\n}<\/pre>\n<h2>6. Trigger Syntax<\/h2>\n<p><span style=\"font-weight: 400\">The language structure of a trigger definition is not the same as a class definition&#8217;s punctuation. A trigger definition begins with the trigger catchphrase. Then it trails by the name of the trigger, the Salesforce protest that the trigger relates with, and the conditions under which it fires.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">trigger TriggerName on ObjectName (trigger_events) {\r\n  code_block\r\n}<\/pre>\n<p><span style=\"font-weight: 400\">To execute a Trigger in Salesforce previously or after embed, refresh, erase, and undelete tasks, indicate various trigger occasions in a comma-isolated rundown. The occasions you can indicate are:<\/span><\/p>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/salesforce-careers-india\/\">Have a look at Salesforce Careers in India<\/a><\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">before insert<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">before update<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">before delete<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">after insert<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">after update<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">after delete<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">after undelete<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Illustration <\/span><br \/>\n<span style=\"font-weight: 400\">This basic Salesforce Trigger flames previously you embed a record and composes a message to the investigate log. <\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the Developer Console, <strong>click File | New | Apex Trigger<\/strong>. <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Enter HelloWorldTrigger for the trigger name, and after that select Account for the sObject. Snap Submit. <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Supplant the default code with the accompanying. <\/span><\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\">trigger HelloWorldTrigger on Account (before insert) {\r\nSystem.debug('Hello World!');\r\n}<\/pre>\n<ul>\n<li><span style=\"font-weight: 400\">To spare, press Ctrl+S. <\/span><\/li>\n<li><span style=\"font-weight: 400\">To test the trigger, make a record.<\/span><\/li>\n<\/ul>\n<p><strong><a href=\"https:\/\/data-flair.training\/blogs\/soql-vs-sosl-salesforce\/\">Let&#8217;s revise SOQL vs SOSL Salesforce<\/a><\/strong><\/p>\n<ol>\n<li><span style=\"font-weight: 400\">Snap Debug | Open Execute Anonymous Window.<\/span><\/li>\n<li>In the new window, including the accompanying and after that snap Execute.<\/li>\n<\/ol>\n<ul>\n<li><span style=\"font-weight: 400\">In the investigate log, discover the Hello World! explanation. The log additionally demonstrates that the trigger has been executed.<\/span><\/li>\n<\/ul>\n<p>So, this was all in Triggers in Salesforce. Hope you like our explanation.<\/p>\n<h2><span style=\"font-weight: 400\">7. Conclusion: Triggers in Salesforce<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Hence, in this Salesforce Triggers tutorial, we learned what is triggers in Salesforce. Moreover, we discussed types of triggers and Salesforce triggers example. Also, we saw Trigger Context Variable, Apex Trigger, and Trigger Syntax. Still, if you have any query, feel free to ask in the comment tab.<\/span><\/p>\n<p><strong>See also &#8211;\u00a0<\/strong><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/static-resource-in-salesforce\/\">Static resource in Salesforce<\/a><\/strong><\/p>\n<p><a href=\"https:\/\/developer.salesforce.com\/\"><strong>For reference<\/strong><\/a><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1786,&quot;href&quot;:&quot;https:\\\/\\\/developer.salesforce.com&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251006133841\\\/https:\\\/\\\/developer.salesforce.com\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-10 00:15:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-14 18:33:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-18 03:15:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-22 16:44:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-29 13:51:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-03 22:37:50&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-09 13:01:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-12 21:28:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-18 13:41:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-22 05:32:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-25 11:13:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-29 19:29:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-02 19:00:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 06:40:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-13 10:00:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-16 17:58:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-19 20:20:09&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 11:17:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-05 01:39:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-10 08:56:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-16 05:36:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-22 12:52:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-26 07:12:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-29 12:01:17&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-03 02:23:49&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-08 09:37:43&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-14 12:29:31&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-17 21:22:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-23 18:37:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-27 13:03:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-02 03:38:59&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-05 23:36:05&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-14 09:09:22&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-18 12:34:57&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-26 14:08:23&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-01 12:13:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-05 09:17:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-15 13:27:16&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-19 13:49:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-23 22:35:31&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-28 12:44:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-07-03 03:32:47&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-07-06 23:59:47&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-07-10 12:21:15&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-14 12:40:33&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-14 12:40:33&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Triggers in Salesforce Tutorial Today, in this Triggers in Salesforce tutorial, we are going to learn what is Triggers in Salesforce. Moreover, we will discuss the Apex Trigger, Types of Triggers in Salesforce.&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":25359,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[988,11860,11861,11862,14937,14939,14940,14942,14943,14944,15122],"class_list":["post-25340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","tag-apex-trigger","tag-salesforce-trigger-context","tag-salesforce-trigger-example","tag-salesforce-triggers","tag-trigger-context-variables","tag-trigger-in-salesforce-best-practices","tag-trigger-syntax","tag-triggers-in-salesforce","tag-triggers-in-salesforce-for-beginners","tag-triggers-in-salesforce-tutorial","tag-types-of-triggers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Triggers in Salesforce | Types of Triggers and Syntax - DataFlair<\/title>\n<meta name=\"description\" content=\"Triggers in salesforce Tutorial,apex Trigger,Types of Triggers in salesforce,Salesforce Trigger syntax,trigger context variables,Salesforce trigger example,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Triggers in Salesforce | Types of Triggers and Syntax - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Triggers in salesforce Tutorial,apex Trigger,Types of Triggers in salesforce,Salesforce Trigger syntax,trigger context variables,Salesforce trigger example,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-03T07:36:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-09-15T06:57:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Triggers in Salesforce | Types of Triggers and Syntax - DataFlair","description":"Triggers in salesforce Tutorial,apex Trigger,Types of Triggers in salesforce,Salesforce Trigger syntax,trigger context variables,Salesforce trigger example,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/","og_locale":"en_US","og_type":"article","og_title":"Triggers in Salesforce | Types of Triggers and Syntax - DataFlair","og_description":"Triggers in salesforce Tutorial,apex Trigger,Types of Triggers in salesforce,Salesforce Trigger syntax,trigger context variables,Salesforce trigger example,","og_url":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-09-03T07:36:45+00:00","article_modified_time":"2018-09-15T06:57:47+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Triggers in Salesforce | Types of Triggers and Syntax","datePublished":"2018-09-03T07:36:45+00:00","dateModified":"2018-09-15T06:57:47+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/"},"wordCount":1236,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg","keywords":["apex Trigger","salesforce trigger context","Salesforce trigger example","Salesforce Triggers","trigger context variables","trigger in salesforce best practices","Trigger syntax","Triggers in salesforce","Triggers in salesforce for beginners","Triggers in salesforce Tutorial","Types of Triggers"],"articleSection":["Salesforce Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/","url":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/","name":"Triggers in Salesforce | Types of Triggers and Syntax - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg","datePublished":"2018-09-03T07:36:45+00:00","dateModified":"2018-09-15T06:57:47+00:00","description":"Triggers in salesforce Tutorial,apex Trigger,Types of Triggers in salesforce,Salesforce Trigger syntax,trigger context variables,Salesforce trigger example,","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/08\/Triggers-in-Salesforce-01.jpg","width":1200,"height":628,"caption":"Triggers in Salesforce | Types of Triggers and Syntax"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/triggers-in-salesforce\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"spring annotations example autowiring","item":"https:\/\/data-flair.training\/blogs\/tag\/spring-annotations-example-autowiring\/"},{"@type":"ListItem","position":3,"name":"Triggers in Salesforce | Types of Triggers and Syntax"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/25340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=25340"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/25340\/revisions"}],"predecessor-version":[{"id":30656,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/25340\/revisions\/30656"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/25359"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=25340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=25340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=25340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}