Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Subscribe to an event
- empApi.subscribe(channel, replayId, $A.getCallback(eventReceived => {
- // Process event (this is called each time we receive an event)
- console.log('Received event ', JSON.stringify(eventReceived));
- }))
- .then(subscription => {
- ...
- });
- {
- "data": {
- "schema": "xxxx",
- "payload": {
- "My_Custom_Field1__c": "value",
- "My_Custom_Field2__c": "value",
- "CreatedById": "xxx",
- "CreatedDate": "xxx"
- },
- "event": {
- "replayId": 11
- }
- },
- "channel": "/event/My_Event__e"
- }
- empApi.subscribe(channel, replayId, $A.getCallback(eventReceived => {
- // Process event (this is called each time we receive an event)
- console.log('Received event ', JSON.stringify(eventReceived));
- // parse the JSON
- var jsonRes = JSON.parse(JSON.stringify(eventReceived));
- // retrieve the custom field values now
- var myCustomField1 = jsonRes.data.payload.My_Custom_Field1__c;
- }))
- .then(subscription => {
- ...
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement