What are Salesforce platform Events?

What are Salesforce platform Events?

Salesforce platform events are used to deliver secure and scalable custom notifications from salesforce to external systems. Platform events are also used to communicate within salesforce and also between lightning applications.
Events are sent independent of the recievers listening to those events. I have explained the events using the diagram below:

Platform Events in salesforce

As you can see above, Event producer send events to event bus and event consumer listens for the event. There can be single producer or also multiple producers.

When to use platform events?

  1. Platform events are very useful when you want to communicate Salesforce with any external system.
  2. Platform events are also used to communicate between two lightning applications.
  3. Platform events are very useful when you want to communicate between two visualforce pages.

How to setup platform event?

Creating of platform event is very similar to the creation of custom object in salesforce. Platform event is a first-class object with the same strongly typed, versioned and customizable schema similar to Salesforce metadata platform.

Go to setup in salesforce and look for platform events and click the link “Platform Events” and start creating your platform events.

Create a new platform event

How to create Platform Events using Apex?

[sourcecode lang=”java”]

//create a list
List listOfOpporEvents=new List();
//create a single event object
Opportunity_Platform__e objEvent=new Opportunity_Platform__e ();

//add opportunity event to list
List<Database.SaveResult> output=EventBus.publish(listOfOpporEvents);


Things to Note regarding Platform Events:

  1. Whenever you are publishing platform events, Governor limits and DML limits are also applied.
  2. You can only use after insert trigger for platform events because you can not update event notifications.
  3. You can not query event notifications using SOQL.

To learn more about these platform events. Click the link here

This Post Has 39 Comments

  1. berkey

    Howdy! This is kind of off topic but I need some guidance from an established blog. Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about setting up my own but I’m not sure where to start. Do you have any points or suggestions? With thanks|

  2. Greg Renfrew

    When I originally commented I clicked the -Notify me when new comments are added- checkbox and today when a comment is added I recieve four emails with the same comment. Perhaps there is by any means you’ll be able to get rid of me from that service? Thanks!

  3. David Rumley

    Your blog is one of a kind, i love the way you organize the topics.,`:*~

  4. Maira

    I’m not sure why but this web site is loading incredibly slow
    for me. Is anyone else having this problem or is it a issue on my end?
    I’ll check back later and see if the problem still

  5. I don’t know whether it’s just me or if perhaps everyone else encountering issues with your
    site. It seems like some of the text within your content are running off the
    screen. Can somebody else please comment and let me know if this is happening
    to them too? This might be a issue with my browser because I’ve had this happen before.

  6. thefeed

    Why viewers still use to read news papers when in this technological world all is presented on net?|

  7. Hi, I wish for to subscribe for this weblog to obtain latest updates, therefore where
    can i do it please assist.

  8. layarkaca21 semi

    I’m not that much of a online reader to be honest but your blogs really nice, keep it up!

    I’ll go ahead and bookmark your site to come back in the future.
    Many thanks

  9. Hello There. I found your blog using msn. This is a very well written article.
    I will be sure to bookmark it and return to read more
    of your useful info. Thanks for the post.

    I will certainly comeback.

  10. feed

    Wow, wonderful blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is fantastic, as well as the content!|

  11. layarkaca21 xxi

    I’ve been browsing online more than 4 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my opinion, if all web owners and bloggers made good
    content as you did, the internet will be much more useful than ever before.

  12. layarkaca21 semi

    If you want to improve your knowledge just keep visiting this site and be updated with the most up-to-date gossip posted here.

  13. layarkaca21 xxi

    Helpful info. Lucky me I discovered your website by accident, and I’m stunned why this accident did not took place in advance!
    I bookmarked it.

  14. I wanted to thank you for this great read!! I absolutely loved every bit of it.
    I have got you saved as a favorite to check out new things you post…

  15. feed

    It’s remarkable in favor of me to have a web site, which is useful in favor of my know-how. thanks admin|

  16. thefeed

    This is really interesting, You are a very skilled blogger. I’ve joined your rss feed and look forward to seeking more of your great post. Also, I’ve shared your web site in my social networks!|

  17. Hello, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam feedback?

    If so how do you stop it, any plugin or anything you
    can recommend? I get so much lately it’s driving me
    insane so any assistance is very much appreciated.

  18. layarkaca21 semi

    Having read this I thought it was rather enlightening. I appreciate you
    taking the time and energy to put this information together.

    I once again find myself personally spending way too much time both reading and posting comments.
    But so what, it was still worthwhile!

  19. Fine way of describing, and nice paragraph to obtain facts about my
    presentation subject matter, which i am going
    to present in institution of higher education.

  20. I have read so many articles on the topic of the blogger lovers except this piece of writing is really a fastidious
    paragraph, keep it up.

  21. Barbra

    Great blog here! Also your web site loads up fast!

    What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as fast as yours lol

  22. Ali

    bookmarked!!, I like your website!

  23. Ladonna

    I’m gone to inform my little brother, that he should also pay a quick visit this website on regular basis to obtain updated from most up-to-date

  24. Brigitte

    These are in fact fantastic ideas in regarding blogging.
    You have touched some nice factors here. Any way keep
    up wrinting.

  25. Velma

    Hey just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two
    different browsers and both show the same results.

  26. Philipp

    Every weekend i used to visit this site, for the reason that i
    wish for enjoyment, as this this site conations really fastidious funny material too.

  27. Harold

    Hey There. I found your blog using msn. This is a very well
    written article. I’ll make sure to bookmark it and return to read more of your useful info.

    Thanks for the post. I’ll definitely return.

  28. Chiquita

    Hello there! I know this is kind of off topic but
    I was wondering if you knew where I could get a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

  29. Alan

    Greetings! I know this is kind of off topic but I was wondering if you knew where I could
    find a captcha plugin for my comment form? I’m using the same blog
    platform as yours and I’m having difficulty finding one?

    Thanks a lot!

  30. Ali

    It’s perfect time to make some plans for the future and it’s time to be happy.
    I have read this post and if I could I want to suggest you some interesting things or suggestions.
    Perhaps you can write next articles referring to this article.
    I desire to read more things about it!

  31. Anton

    If you would like to take a good deal from this post then you have to apply
    these techniques to your won website.

  32. Dieter

    Hi, i think that i noticed you visited my website so i came to return the favor?.I’m trying to in finding things to
    enhance my site!I suppose its good enough to make use of a few of your concepts!!

  33. Lisa

    Heya i’m for the primary time here. I found this board and I in finding It really
    useful & it helped me out a lot. I’m hoping to present
    something again and help others like you aided me.

  34. Alexandria

    If you are going for finest contents like me, simply visit this web site all the time as it gives feature contents,

  35. Bobbie

    Great beat ! I would like to apprentice at the same time as you amend your website, how can i subscribe
    for a weblog website? The account aided me a appropriate deal.
    I were a little bit familiar of this your broadcast provided vivid clear idea

Leave a Reply