• CL Production
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi All,

I am using visulaforce page for Open CTI in lightning experience. It was working fine before 5 days. Suddenly it is not working as expected after winter release.
I was using the below Javascript library to connect with open CTI. Once i clicked from utility bar, My Open CTI item was not displayed properly, it was flipping.
<script src="/support/api/38.0/lightning/opencti_min.js"></script>
So now i am changing the Javascript library to connect with open CTI as below. Now my Open CTI is displayed, but the library not connect with open CTI at the time of API Callout.
<script src="https://domain:port/support/api/44.0/opencti_min.js"></script>
I am getting the below error in browser console.
1. Uncaught TypeError: Cannot read property 'onClickToDial' of undefined
2.Uncaught TypeError: Cannot read property 'setSoftphonePanelHeight' of undefined
anyone please guide me. It is urgent!!
Thanks in Advance.

 
Hi Folks,

My app failed the security review. I am using a javascript custom button and I already had used JSENCODE function. Below is my code that has been provided by the Salesforce security team.
Issue Description

JavaScript of any type is not allowed to run within the Salesforce.com application context. This includes JavaScript blocks within HomePageComponents, WebLinks, Custom buttons and all other components that are run under the Salesforce DOM.

Finding 1 of 1

File

objects\Invoice__c.object
Code

<protected>false</protected>
        <url>{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/connection.js&quot;)} 
{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/apex.js&quot;)} 

if(&quot;{!JSENCODE(Opportunity.Client_ID__c)}&quot;==&quot;&quot;){
   alert(&apos;Opportunity related to this Invoice must be a Client Entity into Freshbooks.&apos;);
}else if(&quot;{!JSENCODE(Account.Account_Id__c)}&quot;==&quot;&quot;){
    alert(&apos;Opportunity related to this Invoice must be associated with a valid Freshbooks Business Entity/Account.&apos;);
}else if(&quot;{!JSENCODE(Opportunity.Email__c)}&quot;==&quot;&quot;){
        alert(&apos;Opportunity related to this Invoice can not have a blank Email address.&apos;);
}else {
   var result = sforce.apex.execute(&quot;Freshbook.syncInvoiceControllerNew&quot;,&quot;getInvoiceDetails&quot;,{invoiceId:&quot;{!JSENCODE(Invoice__c.Id)}&quot;,isClassic:true});
  if(result[0].Freshbook__Synched__c){
       alert(&apos;Invoice Synced Successfully.&apos;);
       location.reload(true); 
   }else{ 
      alert(&apos;Error Occured while Syncing the Invoice with freshbooks.&apos;); 
    }
}</url>
File

Opportunity.object
Code

<url>{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/connection.js&quot;)}
{!REQUIRESCRIPT(&quot;/soap/ajax/38.0/apex.js&quot;)}

if (&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Authentication_URL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Client_Id__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Client_Secret__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.SFBaseURL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Base_URL__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Access_Token__c)}&quot; == &quot;&quot; ||
	&quot;{!JSENCODE($Setup.Freshbooks_App_Credentials__c.Refresh_Token__c)}&quot; == &quot;&quot;)
{
    alert(&apos;1 or more fields in the Custom Setting are null&apos;);
}
else
{
    if (&quot;{!JSENCODE(Opportunity.Email__c)}&quot; == &quot;&quot;)
    {
        alert(&apos;Opportu
File

Payment__c.object
Code

<openType>onClickJavaScript</openType>
        <protected>false</protected>
        <url>{!REQUIRESCRIPT(&quot;/soap/ajax/36.0/connection.js&quot;)} 
{!REQUIRESCRIPT(&quot;/soap/ajax/36.0/apex.js&quot;)} 

if(&quot;{!(Payment__c.Payment_Date__c)}&quot;==null || &quot;{!(Payment__c.Payment_Date__c)}&quot;==&apos;&apos;){

			alert(&apos;Payment Date can not be null&apos;);

}
else{

if(&quot;{!JSENCODE(Payment__c.Account_Id__c)}&quot;!=null) { 
		var result=sforce.apex.execute(&apos;Freshbook.syncPaymentController&apos;,&apos;getPaymentRecord&apos;,{paymentId:&apos;{!JSENCODE(Payment__c.Id)}&apos;, isClassic:true}); 
		if(result[0].Freshbook__Synched__c){
				alert(&apos;Payment successfully Synched.&apos;); 
                  location.reload(true);
		}
		else{
			alert(&apos;Err
Notes

Please don't write javascript in object files

Please let me know where and what I am doing wrong. Any help will be greatly appreciated.

Thanks,
Amit Singh