Using Background Utility Items
Using Events with the Lightning Console JavaScript API
Use Page Context in the Utility Bar API
Using Page References to Open Console Workspace Tabs and Subtabs
Debugging
getChatLog()
sendCustomEvent()
Previous Versions
Sends a custom event to the client-side chat window for a chat with a specific chat key. This method works only in Lightning console apps.
| Name | Type | Description |
|---|---|---|
argumentObj | Object | An object containing all the arguments to be passed into this method. |
| Name | Type | Description |
|---|---|---|
recordId | String | The ID of the event that you want to customize. |
type | String | The name of the custom event type. |
data | String | The data attached to the custom event. |
This example publishes a custom event and logs the result.
Component Code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" description="Conversation toolkit api sample">
2 <aura:attribute name="recordId" type="String" />
3 <lightning:conversationToolkitAPI aura:id="conversationKit" />
4 <ui:button label="sendCustomEvent" press="{!c.sendCustomEvent}" />
5</aura:component>Controller Code:
1({
2 sendCustomEvent: function(cmp, evt, helper) {
3 var conversationKit = cmp.find("conversationKit");
4 var recordId = cmp.get("v.recordId");
5 var type = "myCustomEventType";
6 var data = "myCustomEventData";
7 conversationKit.sendCustomEvent({
8 recordId: recordId,
9 type: type,
10 data: data
11 })
12 .then(function(result){
13 if (result) {
14 console.log("Successfully sent custom event");
15 } else {
16 console.log("Failed to send custom event");
17 }
18 });
19 }
20})The custom event type must match the name of your custom event. Replace myCustomEventType with your own custom event name.
Returns a Promise. Success is indicated if the promise is fulfilled. Failure is indicated if the catch clause is invoked.