Skip to main content

Application Events

Works on publish-subscribe model.

3 phases in Application Event Propagation:
Capture
Bubble
Default

Sequence of application event propagation:
1. Event fired.
2. Capture Phase
3. Bubble Phase
4. Default Phase

Importance of fire() method:
fire() is used to fire an event.

EVENTS BEST PRACTICES:
1. Use component Events whenever possible. Salesforce prefers <Component> more than <Application> if possible.
However you should know the difference:

Component follows a hierarchical model and can only be handled by components above them. And it uses a localised usage.

Application allows communication between components at applications level (no hierarchical model). So this is preferable when communication is required.

2. Seperate the low level events from business logic events

That means handle the low level events in event handler and refire them as higher level events.

3.Dynamic actions should be based on component state.

4. Using a dispatcher component to listen and relay events.

In case of large number of handler components listening for an event, dispatcher component can do some logic and fire components.

Comments

Popular posts from this blog

Connected App

 A connected app is a framework that enables an external application to integrate with Salesforce using APIs and standard protocols, such as SAML, OAuth, and OpenID Connect. Connected apps use these protocols to authenticate, authorize, and provide single sign-on (SSO) for external apps. The external apps that are integrated with Salesforce can run on the customer success platform, other platforms, devices, or SaaS subscriptions. For example, when you log in to your Salesforce mobile app and see your data from your Salesforce org, you’re using a connected app. https://help.salesforce.com/articleView?id=sf.connected_app_overview.htm&type=5 By capturing metadata about an external app, a connected app tells Salesforce which protocol—SAML, OAuth, and OpenID Connect—the external app uses, and where the external app runs. Salesforce can then grant the external app access to its data, and attach policies that define access restrictions, such as when the app’s access expires. Salesforc...