Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Created October 11, 2018 20:59
Show Gist options
  • Save choudharymanish8585/4f072995b7d6aae6c1d0415d31a1f6d3 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/4f072995b7d6aae6c1d0415d31a1f6d3 to your computer and use it in GitHub Desktop.
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName"
access="global"
controller="RecordChangeCaptureLightningController">
<aura:attribute name="channelName" type="String" default="" />
<aura:attribute name="autoRefresh" type="String" default="Yes" />
<aura:attribute name="isSupported" type="Boolean" default="false" />
<!--Loading list of supported object for change events
- This can be configured in a custom setting or custom metadata type also
- however, in that case you need to make a server side call to get the data
- which i am trying to avoid here -->
<ltng:require scripts="{!$Resource.SupportedObjectsForChangeEvents}" afterScriptsLoaded="{!c.checkCompatibility}" />
<!--Include EmpApiDemo child component and pass channel name to subscribe
ex: "/topic/AccountSpy" is my pushtopic channel name
once the event is fired, it will handled in handleMessage controller method -->
<aura:if isTrue="{!v.isSupported}">
<c:RecordChangeEventHandler channelName="{!v.channelName}" onRecordChange="{!c.handleMessage}" />
<aura:set attribute="else">
<div style="color:red;font-weight: bold;">Record Change Capture does not support this object/record page.</div>
</aura:set>
</aura:if>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment