function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MirelaMirela 

CTI adapter js code implemented in a visualforce page works in SF but doesn't work in SF Console

Hi all,

 

I have a problem and I haven't found too many topics on this subject.

On a custom visualforce page I had to implement CTI Click to dial links for some phone fields. To make it work, because I discover that the CTI adapter won't recognize those fields as phone numbers on custom vf pages (and I use the Contact standard Phone field), I had to add a link on the phone number something like this:


<a href="javascript&colon;sendCTIMessage(%27/CLICK_TO_DIAL?DN=%27%2BencodeURIComponent(%27(801)%20440-5157%27)%2B%27&ID=003M0000003ytsbIAA&ENTITY_NAME=Contact%27);">(801) 440-5157</a>

 

And this works like a charm in that  visualforce page but, the client wants to use it in the Console. And when I open the same page there and I click the link the CTI adapter has no reaction at all... nothing happens.

Any idea on this one?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
sfdcAnonsfdcAnon

Hi Mirela,

In the Console the parent page is in the SFDC domain, while the Visualforce page is in the Visualforce domain. These 2 domains cannot communicate with each other.

 

When sendCTIMessage is called, the message is sent up to the browser window housing the softphone. For the Console, this is in the salesforce domain. When you call it from a Visualforce page, that communication cannot happen.

 

In the standard application both the softphone and calling element are in the same frame and same domain. The message is sent successfully.

 

There is a way to get around this. Have a look here - How to build a Custom Interaction Log.

http://blogs.salesforce.com/product/2012/02/custominteractionlog.html

There's a new method in the Service Cloud Console Integration Toolkit call sendCTIMessage. Use that instead of the direct JavaScript call.

All Answers

sfdcAnonsfdcAnon

Hi Mirela,

In the Console the parent page is in the SFDC domain, while the Visualforce page is in the Visualforce domain. These 2 domains cannot communicate with each other.

 

When sendCTIMessage is called, the message is sent up to the browser window housing the softphone. For the Console, this is in the salesforce domain. When you call it from a Visualforce page, that communication cannot happen.

 

In the standard application both the softphone and calling element are in the same frame and same domain. The message is sent successfully.

 

There is a way to get around this. Have a look here - How to build a Custom Interaction Log.

http://blogs.salesforce.com/product/2012/02/custominteractionlog.html

There's a new method in the Service Cloud Console Integration Toolkit call sendCTIMessage. Use that instead of the direct JavaScript call.

This was selected as the best answer
MirelaMirela

Thanks a lot gvasudev! That was very useful and I managed to make it work in Console. So, thanks again!

 

CharlieSCharlieS

Gautam,

 

I'm sorry, but I've read your blog (about creating a CIL) and I still don't understand how I can use it in my scenario.

 

Can you (or Mirela?) post a sample of the code that will allow a visualforce page displaying within the service console to enable click to dial links for fields that are of type 'phone'.

 

I have a test visual force page that is being displayed as part of the contact page layout.  The VF page is simply :

 

<apex:page standardController="Contact" showChat="false">
    <apex:form >
        <apex:pageBlock mode="inlineEdit">
            <apex:pageBlockSection columns="2">
                <apex:outputField value="{!contact.phone}" rendered="{!contact.Contact_Active__c}">
                    <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"  hideOnEdit="editButton" event="ondblclick"  changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
                </apex:outputField>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 thanks very much for your help

 

 

Charlie

Mirela12Mirela12

Hi Charlie,

 

This code worked for me in the service console (the second part, as you will notice is just an image added as a resource to make it look like a normal click-to-dial link, what realy matters is the href part). Hope this will be helpfull for you too, I've spent days searching for a solution on this one.

 

<a href="javascript&colon;sforce.console.cti.sendCTIMessage(%27/CLICK_TO_DIAL?DN=%27%2BencodeURIComponent(%27{!Contact.Phone}%27)%2B%27&ID={!Contact.Id}&ENTITY_NAME=Contact%27);"  style="cursor:pointer; cursor:hand; text-decoration:underline;">{!Contact.Phone}&nbsp;&nbsp;<apex:image value="{!$Resource.PhoneIcon}" height="10" width="10" /></a>

 

CharlieSCharlieS

Thanks for your suggestion - I had seen your earlier post, and I had managed to get something very similar working.

 

The problem is that this still isn't as clever as the way the standard page layout works.  In a standard page layout (with inline editing) the users are able to double click near a phone number to edit it, or click on it to click-to-dial.

 

The solution that you suggested creates a simple link - it is not editable.  So I have to display the field twice on the same page layout:  Once so that the user can edit it, and once so that they can click to dial.

 

It is a waste of space, and it seems a shame that the new pretty CTI can't be used within visualforce pages...