• Marek Cech
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hi guys,

I've been trying to use Lightning Open CTI to implement a softphone for Lightning Service Console. Click2dial-related functions work like a charm but screenPop() function keeps throwing this:

This page has an error. You might just need to refresh it. Action failed: c:TestCompo$controller$handleClick [Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.] Failing descriptor: {c:TestCompo$controller$handleClick}

I've created a Visualforce page and Call Center. The page contains Lightning components. Open CTI is included in page:
​<apex:includeScript value="/support/api/41.0/lightning/opencti_min.js"/>
Even a simple copy pasted code throws the error mentioned above:
sforce.opencti.screenPop({
    type: sforce.opencti.SCREENPOP_TYPE.SOBJECT,
    params: {
        recordId: '0012F0000089wQuQAI'
    }
});
I've double checked that account with hardcoded ID exists in the system.

Any idea how to solve this?
Thanks

 
Hi,

I've developed a custom Open CTI implementation for Lightning Service Console. I've been using Lightning components which are wrapped in a Visualforce page (to be able to create a Call Center and use click2dial - which is not possible without Visualforce as I found out). This results in an iframe which contains the Visualforce page. Unfortunately workspaceAPI stopped working when being in the iframe.
I've used workspaceAPI in the following way:
<lightning:workspaceAPI aura:id="workspace" />
Controller looks like this:
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
    recordId:'0012F0000089wQuQAI',
	focus: true
}).then(function(response) {
	console.log('in then');
	workspaceAPI.focusTab({
	    tabId: response
	});
}).catch(function(error) {
	 console.log('in catch');
});
I've double checked that record ID exists. This code does not throw an error, 'in then' and 'in catch' is never logged to JS console and tab is not opened. Basically any functionality of workspaceAPI does not work in iframe.

Thanks for any help.
Marek
 
Hi,

I've got a problem with Continuation. In one of several hundread executions the method for processing response is not executed. There is logging in the method so I'm pretty sure this happens. Wierd thing is that onComplete Javascript function of ActionFunction is executed.

public Continuation moveToStage5() {
        Continuation cont = new Continuation(timeout);
        cont.continuationMethod = 'processMoveToStage5Response';

        AsyncSapOrderWS.Asyncy_sf_saveorder service = new AsyncSapOrderWS.Asyncy_sf_saveorder();
        activationResponse = service.beginYSfSaveorder(cont, acc.SAP_ID__c, latestOrderDto.customerNote, sapUserId, 
            orderRecord.OrderNumber, SAP_ORDER_TYPE, preferedDeliveryDate, priceDate, latestOrderProducts, 
            selectedSellingOrganisation, orderSalesType, '');
        
        return cont;
}

public Object processMoveToStage5Response() {
        SapOrderWS.YSfSaveorderResponse_element response;
        try {
            response = activationResponse.getValue();

            GlobalUtility.logMessage(GlobalUtility.DEBUG, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                response.toString(), null, null, 0, true);

        } catch (Exception e) {
            response = new SapOrderWS.YSfSaveorderResponse_element();
            response.Error = Label.errMsg_ErrorCreatingOrder + ' ' + Label.msg_PleaseContactAdmin + ' (' + e + ')';
            GlobalUtility.logMessage(GlobalUtility.ERROR, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                Label.errMsg_ErrorCreatingOrder, null, e, 0, false);
                
            orderResponseJson = JSON.serialize(response);
            return null;
        }
        return null;
    }

Has anyone experienced such thing?
Hi,

I've developed a custom Open CTI implementation for Lightning Service Console. I've been using Lightning components which are wrapped in a Visualforce page (to be able to create a Call Center and use click2dial - which is not possible without Visualforce as I found out). This results in an iframe which contains the Visualforce page. Unfortunately workspaceAPI stopped working when being in the iframe.
I've used workspaceAPI in the following way:
<lightning:workspaceAPI aura:id="workspace" />
Controller looks like this:
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
    recordId:'0012F0000089wQuQAI',
	focus: true
}).then(function(response) {
	console.log('in then');
	workspaceAPI.focusTab({
	    tabId: response
	});
}).catch(function(error) {
	 console.log('in catch');
});
I've double checked that record ID exists. This code does not throw an error, 'in then' and 'in catch' is never logged to JS console and tab is not opened. Basically any functionality of workspaceAPI does not work in iframe.

Thanks for any help.
Marek
 
Hi,

I've developed a custom Open CTI implementation for Lightning Service Console. I've been using Lightning components which are wrapped in a Visualforce page (to be able to create a Call Center and use click2dial - which is not possible without Visualforce as I found out). This results in an iframe which contains the Visualforce page. Unfortunately workspaceAPI stopped working when being in the iframe.
I've used workspaceAPI in the following way:
<lightning:workspaceAPI aura:id="workspace" />
Controller looks like this:
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
    recordId:'0012F0000089wQuQAI',
	focus: true
}).then(function(response) {
	console.log('in then');
	workspaceAPI.focusTab({
	    tabId: response
	});
}).catch(function(error) {
	 console.log('in catch');
});
I've double checked that record ID exists. This code does not throw an error, 'in then' and 'in catch' is never logged to JS console and tab is not opened. Basically any functionality of workspaceAPI does not work in iframe.

Thanks for any help.
Marek
 
Hi,

I've got a problem with Continuation. In one of several hundread executions the method for processing response is not executed. There is logging in the method so I'm pretty sure this happens. Wierd thing is that onComplete Javascript function of ActionFunction is executed.

public Continuation moveToStage5() {
        Continuation cont = new Continuation(timeout);
        cont.continuationMethod = 'processMoveToStage5Response';

        AsyncSapOrderWS.Asyncy_sf_saveorder service = new AsyncSapOrderWS.Asyncy_sf_saveorder();
        activationResponse = service.beginYSfSaveorder(cont, acc.SAP_ID__c, latestOrderDto.customerNote, sapUserId, 
            orderRecord.OrderNumber, SAP_ORDER_TYPE, preferedDeliveryDate, priceDate, latestOrderProducts, 
            selectedSellingOrganisation, orderSalesType, '');
        
        return cont;
}

public Object processMoveToStage5Response() {
        SapOrderWS.YSfSaveorderResponse_element response;
        try {
            response = activationResponse.getValue();

            GlobalUtility.logMessage(GlobalUtility.DEBUG, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                response.toString(), null, null, 0, true);

        } catch (Exception e) {
            response = new SapOrderWS.YSfSaveorderResponse_element();
            response.Error = Label.errMsg_ErrorCreatingOrder + ' ' + Label.msg_PleaseContactAdmin + ' (' + e + ')';
            GlobalUtility.logMessage(GlobalUtility.ERROR, AddOrderController.class.getName(), 'processMoveToStage5Response', null, null, 
                Label.errMsg_ErrorCreatingOrder, null, e, 0, false);
                
            orderResponseJson = JSON.serialize(response);
            return null;
        }
        return null;
    }

Has anyone experienced such thing?
I am doing 2 webservice callouts from VF page contorller method which i am calling from action attribute of <apex:page> tag(onloading of page) and now i am trying to convert those two callouts into asynchronous callouts using continuation API class as stated in below link. Those two callouts need to happen in one single transaction.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_continuation_overview.htm

But i am getting below errors.

Error-1: line -1, column -1: Continuation is not serializable.

Error-2: 
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. 

Thank you again for your patience and assistance. And thanks for using salesforce.com! 

Error ID: 1529128587-55318 (-735899706)

So please help me?
We have been working on a custom softphone implementation for Lightning Service Console. The Lightning component we created has been added to Console as Utility Bar’s custom Lightning component. This means that we did not wrap the component with a Visualforce page and we did not create a Call Center.
 
Problem is with click2dial functionality. We’ve found this tutorial: https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_enableclicktodial_lex.htm
 
When we added ‘/support/api/40.0/lightning/opencti_min.js’ to the Lightning component we get a Javascript error ‘Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters’.
We have found following discussion: https://developer.salesforce.com/forums/?id=9060G000000MOplQAG
Unfortunately we do not have a Visualforce to add ‘sfdcIframeOrigin’ parameter to URL.
 
Is it possible to use click2dial functionality within Lightning components which are not wrapped in Visualforce?
Hello,
i have long running callout on my visualforce page implemented via Continuation class. It works well in most cases, but sometimes (1 of 10 000 calls) there are two types of unexpected behavior.

1) oncomplete is not called after return from controller (processMoveToStage5Response method has run properly and response has been logged).

or

2) oncomplete is called but rerender is not performed, so activatedOrderResponseJson element's html on page is not rendered (but processMoveToStage5Response  processed response properly and response is logged).

Timeout for Continuation and WS is set to the same value (120 s).

Do you have an idea what can be cause of this behavior?

Thanks
Honza

Visualforce page:
<apex:form >
	<apex:outputPanel id="errorMessage" styleClass="hidden errorMessage">{!errorMessage}</apex:outputPanel>
	<apex:outputPanel id="activatedOrderResponseJson" styleClass="hidden activatedOrderResponseJson">{!activatedOrderResponseJson}</apex:outputPanel>

	<apex:actionFunction action="{!moveToStage5}" onComplete="onMovedToStage5()" name="startMoveToStage5" reRender="activatedOrderResponseJson,errorMessage" />

</apex:form>

Controller:
public Continuation moveToStage5() {
    Continuation cont = new Continuation(timeout);
    cont.continuationMethod = 'processMoveToStage5Response';

    AsyncWS.Asyncy_sf_webservice service = new AsyncWS.Asyncy_sf_webservice();
    activationResponse = service.method(cont, ... params ..);

    return cont;
}

public void processMoveToStage5Response() {
    AsyncWS.YSfSaveorderResponse_element response;
    try {
        response = activationResponse.getValue();
        //logging of response
    } catch(Exception e) {
        //logging of error
        return;
    }

    activatedOrderResponseJson = JSON.serialize(response);
}