You need to sign in to do that
Don't have an account?
Abhishekh Jaiswal
Lightning Console JavaScript API is not working
Hi,
We are integrating omnichannel with CTI where we want to get and set omnichannel channel status.
The issue is we are not able to set the status and get the changed status event in "Lightning Console JavaScript API".
I have tried with this below code.
1:
MethodComponet
<aura:component implements="flexipage:availableForAllPageTypes" access="global" > <lightning:omniToolkitAPI aura:id="omniToolkit" /> <lightning:button label="Set Status" onclick="{! c.setStatus }" /> </aura:component>
MethodController
({ setStatus: function(cmp, evt, hlp) { var omniAPI = cmp.find("omniToolkit"); omniAPI.setServicePresenceStatus({statusId: "0N5xx0000000002"}).then(function(result) { console.log('Current statusId is: ' + result.statusId); console.log('Channel list attached to this status is: ' + result.channels); }).catch(function(error) { console.log(error); }); } })
2:
EventComponent
<aura:component implements="flexipage:availableForAllPageTypes"access="global" > <lightning:omniToolkitAPI aura:id="omniToolkit" /> <aura:handler event="lightning:omniChannelStatusChanged" action="{! c.onStatusChanged }"/> </aura:component>
EventController
({ onStatusChanged : function(component, event, helper) { console.log("Status changed."); var statusId = event.getParam('statusId'); var channels = event.getParam('channels'); var statusName = event.getParam('statusName'); var statusApiName = event.getParam('statusApiName'); console.log(statusId); console.log(channels); console.log(statusName); console.log(statusApiName); }, })
Kindly check below two links i hopes it must be useful for you.
https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_js_getting_started.htm
https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lex_getting_started.htm
Abhishek if you still face challenges and are not able to do the work you can reach me for small concept salesforce lightning training (https://www.maxmunus.com/page/Salesforce-Lightning-Training) / Salesforce training (https://www.maxmunus.com/page/Online-Training/Salesforce-Training) and project support.
https://www.maxmunus.com/page/Salesforce-Lightning-Training
OR you can also email me at contact@maxmunus.com, +919035888988
Thanks for the reply Asthana,
I have already gone through the above links but it's not helpful, as you can see that I have tried it in EventComponent and EventController but not getting the response.