• Abhishekh Jaiswal
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies

We have a lightning component and we are trying to render this to a specific user using the user's profile section in salesforce org.

Is there a possible way, so we can provide the access to a specific user?

We want to develop an app exchange softphone application using the features of Service cloud voice. Do we get any demo project or prototype to implement it?

And is there any related documentation to follow the implementation action?

 

Hi,

We have created a trigger on UserServicePresence object and now we want to write apex test classes for it,

For this below trigger we are trying to write an apex test class, we have tried but getting 0 code coverage as we can't perform DML operation on UserServicePresence, so please help us to write test classes for it.

trigger AbcAndOSHandler on UserServicePresence (after insert) {
    public String cStatus {get;set;}
    sObject data = [SELECT abc_User__c, abc_pword__c, abc_key__c, abc_web_URL__c, abc_o_Status__c, abc_Is_abc__c FROM abc_Data__mdt where DeveloperName = 'ABCDetails'];
    String uname = (String) data.get('abc_User__c');
    String pword = (String) data.get('abc_pword__c');
    String key = (String) data.get('abc_key__c');
    String webURL = (String) data.get('abc_web_URL__c');
    cStatus = (String) data.get('abc_o_Status__c');
    Boolean isABC = (Boolean) data.get('abc_Is_abc__c');
   
    String s = '';
    String uId = userinfo.getUserId();
    sObject ext = [SELECT Extension FROM User where Id =: uId ];
    String extension = (String) ext.get('Extension');
    String content = abcweb.jsonContent(Trigger.new, Trigger.old);
    String sName = '';
    List<Object> m = (List<Object>)JSON.deserializeUntyped(cStatus);
    for(Object sdata : m) {
        Map<String, Object> m1 = (Map<String, Object>)sdata;
        for (Integer j = 0; j <= m1.size(); j++) {
            if(String.valueof(m1.get('sId')) == content) {
                String lcsValue =   (String) (m1.get('sValue'));
                if(lcsValue != null) {
                    s = (m1.get('sValue')).toString();
                }
                sName = (m1.get('sLabel')).toString();
            }
        }
    }
    String url = webURL+'?uname='+uname+'&pword='+pword+'&key='+key+'&ext='+extension+'&s='+s;
    if(isABC == true) {
        abcweb.callout(url, content);
    }
}
Thanks...

Hi

We have implemented the softphone in Salesforce using open CTI and we are now integrating its status changes with Salesforce Omnichannel statuses, in other words, we want to get an event in our app when the user changes his/her onmichannel status so we can also change his status also in softphone system.

We are using Visualforce page and omniToolkitAPI, however, it didn't work as we found in the lightning documentation that we can't fire lightning events from lightning out.

So how we can achieve our requirements?

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); }, })

We have a lightning component and we are trying to render this to a specific user using the user's profile section in salesforce org.

Is there a possible way, so we can provide the access to a specific user?

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); }, })