{"id":3218,"date":"2018-06-04T06:51:31","date_gmt":"2018-06-04T06:51:31","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=3218"},"modified":"2024-02-15T09:12:22","modified_gmt":"2024-02-15T09:12:22","slug":"salesforce-platform-events-what-use","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2018\/06\/04\/salesforce-platform-events-what-use\/","title":{"rendered":"Salesforce Platform Events &#8211; What are they &#038; how to use"},"content":{"rendered":"<p>While there are tons of documentation highlighting about platform events and their use cases there are even trailhead modules, recently we came up with the question that how should someone be able to tell a Salesforce rookie what a platform event is? Yes, it\u2019s a platform-based notification system which can help orchestrate a proper integration routine but explaining this to someone who has just begun his\/her coding is a bit harsh. So, what&#8217;s platform event in basic terms and how is it helpful to me?<\/p>\n<p>Consider this, a platform event is just like another custom object but this would only be referred by external systems to communicate with <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce<\/a>. To put this in a scenario when a certain system posts data on a Salesforce endpoint then that data should be fetched and the data in Salesforce should be updated. Of course, you can use too many lines of code to continuously fetch and retrieve the data from the endpoint or just wait for data to be posted based on which an event shall be triggered and the next processes shall follow. Now, this is where platform event comes into the picture, instead of writing lines and lines of codes and continuously requesting and checking if the data is posted we can just have a platform event trigger notify us and then have your logic do the rest of the heavy lifting.<\/p>\n<p>Now, that we have convinced you why Platform events are good, let&#8217;s give you a quick walkthrough of it. From your Setup, in quick find box search for \u201cPlatform Events\u201d then click on \u201cNew Platform Event\u201d then just like your Custom Object enter the label and API name for your Platform Event. Once completed then add any Custom Fields you want. Now, for demo purpose we will be naming our platform event as \u201cDemo Event\u201d and we will be adding two fields to it named Account Number and Account Name.<br \/>\n<strong>Note-<\/strong> Platform event end with \u201c__e\u201d instead of \u201c__c\u201d notifying that they are platform event and differing from custom object.<\/p>\n<div id=\"attachment_3229\" style=\"width: 1084px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/1.-Creating-new-Platform-Event.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img fetchpriority=\"high\" decoding=\"async\" aria-describedby=\"caption-attachment-3229\" class=\"size-full wp-image-3229\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/1.-Creating-new-Platform-Event.jpg\" alt=\"Creating new Platform Event\" width=\"1074\" height=\"557\" \/><\/a><p id=\"caption-attachment-3229\" class=\"wp-caption-text\">Creating new Platform Event<\/p><\/div>\n<p>Once you are satisfied with you Platform Event and your fields click on \u201cNew\u201d trigger for your platform event, then add the below code.<\/p>\n<div id=\"attachment_3225\" style=\"width: 1011px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/2.-Platform-Event-Trigger.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" aria-describedby=\"caption-attachment-3225\" class=\"size-full wp-image-3225\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/2.-Platform-Event-Trigger.jpg\" alt=\"Platform Event Trigger\" width=\"1001\" height=\"541\" \/><\/a><p id=\"caption-attachment-3225\" class=\"wp-caption-text\">Platform Event Trigger<\/p><\/div>\n<p>Now, log into Workbench then under Utilities section click on \u201cRest Explorer\u201d, now, in your execute section after your version number just append \u201c\/sobjects\/\/\u201d <strong>e.g.-<\/strong>\u201d\/services\/data\/v42.0\/sobjects\/Demo_Event__e\/\u201d and in request body just add the below JSON and click on execute, once the request is processed your record will be updated.<\/p>\n<div id=\"attachment_3226\" style=\"width: 753px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/3.-Demo-Request.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" aria-describedby=\"caption-attachment-3226\" class=\"size-full wp-image-3226\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/3.-Demo-Request.jpg\" alt=\"Demo Request\" width=\"743\" height=\"238\" \/><\/a><p id=\"caption-attachment-3226\" class=\"wp-caption-text\">Demo Request<\/p><\/div>\n<div id=\"attachment_3227\" style=\"width: 641px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/4.-Account-Name-before-processing-the-request.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3227\" class=\"size-full wp-image-3227\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/4.-Account-Name-before-processing-the-request.jpg\" alt=\"Account Name before processing the request\" width=\"631\" height=\"145\" \/><\/a><p id=\"caption-attachment-3227\" class=\"wp-caption-text\">Account Name before processing the request<\/p><\/div>\n<div id=\"attachment_3228\" style=\"width: 568px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/5.-Updated-Account-Name-after-processing-the-request.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3228\" class=\"size-full wp-image-3228\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2018\/06\/5.-Updated-Account-Name-after-processing-the-request.jpg\" alt=\"Updated Account Name after processing the request\" width=\"558\" height=\"185\" \/><\/a><p id=\"caption-attachment-3228\" class=\"wp-caption-text\">Updated Account Name after processing the request<\/p><\/div>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Greytrix<\/a> is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customization\u2019s, data migration, system integrations, third-party add-on development and implementation expertise.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Greytrix<\/a> has some unique solutions for Cloud CRM such as Salesforce integration with <a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\" target=\"_blank\" rel=\"noopener noreferrer\">Sage X3<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\" target=\"_blank\" rel=\"noopener noreferrer\">Sage 100<\/a> and <a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\" target=\"_blank\" rel=\"noopener noreferrer\">Sage 300<\/a>. We also offer best-in-class Cloud CRM <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\" target=\"_blank\" rel=\"noopener noreferrer\">Salesforce customization and development services<\/a> to business partners and end users. <a href=\"https:\/\/www.greytrix.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Greytrix<\/a> has some unique solutions for On-Premise CRM such as Sage CRM integration with <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-x3-integration\" target=\"_blank\" rel=\"noopener noreferrer\">Sage X3<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-100-erp-integration\" target=\"_blank\" rel=\"noopener noreferrer\">Sage 100<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-300-erp-integration\" target=\"_blank\" rel=\"noopener noreferrer\">Sage 300<\/a>, <a href=\"https:\/\/www.greytrix.com\/gumu\/gumu-for-sage-crm-sage-intacct-integration\/\" target=\"_blank\" rel=\"noopener\">Sage Intacct<\/a> and <a href=\"https:\/\/www.greytrix.com\/sage-crm\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sage 50<\/a>. We also offer best-in-class On-Premise <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/sage-crm\" target=\"_blank\" rel=\"noopener noreferrer\">Sage CRM customization and development services<\/a> to business partners and end users.<\/p>\n<p>For more information, please contact us at <a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><strong><span style=\"font-size: Medium;\">Related Posts<\/span><\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2018\/05\/29\/docusign-integration-with-salesforce-using-docusign-apis-part-2\/\" target=\"_blank\" rel=\"noopener noreferrer\">DocuSign Integration with Salesforce using DocuSign API\u2019s-Part 2<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2018\/05\/23\/docusign-integration-with-salesforce-using-docusign-apis-part-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">DocuSign Integration with Salesforce using DocuSign API\u2019s-Part 1<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/10\/06\/how-to-rename-the-field-label-in-salesforce-for-managed-package\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to rename the Field label in Salesforce for managed package<\/a><\/li>\n<li><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2017\/08\/09\/implementing-rss-feeds-on-your-home-page-using-visualforce-page\/\" target=\"_blank\" rel=\"noopener noreferrer\">Implementing RSS feeds on your Home Page using Visualforce page<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>While there are tons of documentation highlighting about platform events and their use cases there are even trailhead modules, recently we came up with the question that how should someone be able to tell a Salesforce rookie what a platform event is? Yes, it\u2019s a platform-based notification system which can help orchestrate a proper integration\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2018\/06\/04\/salesforce-platform-events-what-use\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[15,895,68,909,118,119,262,263,311,910,544],"class_list":["post-3218","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-apex-development","tag-apex-triggers","tag-custom-object","tag-event-api","tag-event-trigger","tag-event-trigger-salesforce-when-data-posted","tag-platform-event","tag-platform-events","tag-rest-api-in-salesforce","tag-rest-explore","tag-workbench"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/3218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=3218"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/3218\/revisions"}],"predecessor-version":[{"id":7977,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/3218\/revisions\/7977"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=3218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=3218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=3218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}