• Antonio Giraffa
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Hi to all, I have an aura component, i developed it in sandbox, and it fully works, if passed to the test environment when I try to open it i've got the following error:
sforce is not defined

The function that is responsible is this:
 
editPanel: function(cmp, evt, helper) {
        var params = evt.getParams();
        if (params.label) {
            sforce.opencti.setSoftphonePanelLabel({
                label: params.label
            });
        }
    },

in the sforce.opencti part,
I tried to import connection.js and apex.js, but still no luck, can anyone help me to find out why this happens?
Thanks in advance, Antonio.
Hi to all, I'm struggling understanding how events in aura components works:
I have the openCTI softphone component, I'm trying to fire an event from parent to child component, the problem is that the event is handled ONLY by the same component (the one where i fire it) it seems to be unable to "exit" from the original component.

I also tried to make the event of type APPLICATION, but I wasn't lucky at all, the event is fired but it is listened only on the original component:

This is how i handle the event on the interested component:
<aura:handler event="c:doneWaiing" action="{!c.doneWaiting}">

with a controller method on the target component controller handling this, but this method is NEVER executed i have a console.log that never prints, so..


This is how I register the event on the original component:
<aura:registerEvent name="doneWaiting" type="c:doneWaiting"/>

This is the event:
<aura:event type="APPLICATION" description="Event fired by the softphone after retrieving the devices list.">
	
</aura:event>

This is the firing procedure:


 
let doneWaiting = cmp.getEvent('doneWaiting');
 
            console.log(doneWaiting);
            doneWaiting.fire();

the event is present and fires, but it is no handled by other components,
 
tried also to retrieve the event like this:
 
$A.get("e.c:doneWaiting");

but it returns undefined.

 

Hello, I'm having troubles trying to get data from google maps api, specifically distance  matrix service.

The problem is that every time i send the request via salesforce i got a 400 error, BUT if I take the url of the endpoint from the logs and paste it in a browser the json is returned regularly:

Here is the code that I'm using: Am I missing something? Thank you in advance.

 

public String getJsonResults(
            String address1,
            String address2) {
        
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HttpRequest request = new HttpRequest();
				
                
         String url = 'https://maps.googleapis.com/maps/api/distancematrix/json'
            + '?key=......'
            + '&origins=' + address1
            + '&destinations=' + address2
            + '&mode=driving'
            + '&sensor=false'
            + '&language=en'
            + '&units=imperial';
            System.debug('url:   ' + url);
                
        request.setEndpoint(url);
        request.setMethod('GET');
        HttpResponse response = http.send(request);


that's what i get from system.debug when I check for the request:
System.HttpRequest[Endpoint=https://maps.googleapis.com/maps/api/distancematrix/json?key=......&origins=Via Celano,Avezzano&destinations=Via Roma,Aquila&mode=driving&sensor=false&language=en&units=imperial, Method=GET]
If i paste this string in a browser, it works. 

Already added the endpoint "https://maps.googleapis.com" to remote sites, what should I do? Thanks again

Hi to all, I have an aura component, i developed it in sandbox, and it fully works, if passed to the test environment when I try to open it i've got the following error:
sforce is not defined

The function that is responsible is this:
 
editPanel: function(cmp, evt, helper) {
        var params = evt.getParams();
        if (params.label) {
            sforce.opencti.setSoftphonePanelLabel({
                label: params.label
            });
        }
    },

in the sforce.opencti part,
I tried to import connection.js and apex.js, but still no luck, can anyone help me to find out why this happens?
Thanks in advance, Antonio.
Hi to all, I'm struggling understanding how events in aura components works:
I have the openCTI softphone component, I'm trying to fire an event from parent to child component, the problem is that the event is handled ONLY by the same component (the one where i fire it) it seems to be unable to "exit" from the original component.

I also tried to make the event of type APPLICATION, but I wasn't lucky at all, the event is fired but it is listened only on the original component:

This is how i handle the event on the interested component:
<aura:handler event="c:doneWaiing" action="{!c.doneWaiting}">

with a controller method on the target component controller handling this, but this method is NEVER executed i have a console.log that never prints, so..


This is how I register the event on the original component:
<aura:registerEvent name="doneWaiting" type="c:doneWaiting"/>

This is the event:
<aura:event type="APPLICATION" description="Event fired by the softphone after retrieving the devices list.">
	
</aura:event>

This is the firing procedure:


 
let doneWaiting = cmp.getEvent('doneWaiting');
 
            console.log(doneWaiting);
            doneWaiting.fire();

the event is present and fires, but it is no handled by other components,
 
tried also to retrieve the event like this:
 
$A.get("e.c:doneWaiting");

but it returns undefined.

 

Hello, I'm having troubles trying to get data from google maps api, specifically distance  matrix service.

The problem is that every time i send the request via salesforce i got a 400 error, BUT if I take the url of the endpoint from the logs and paste it in a browser the json is returned regularly:

Here is the code that I'm using: Am I missing something? Thank you in advance.

 

public String getJsonResults(
            String address1,
            String address2) {
        
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HttpRequest request = new HttpRequest();
				
                
         String url = 'https://maps.googleapis.com/maps/api/distancematrix/json'
            + '?key=......'
            + '&origins=' + address1
            + '&destinations=' + address2
            + '&mode=driving'
            + '&sensor=false'
            + '&language=en'
            + '&units=imperial';
            System.debug('url:   ' + url);
                
        request.setEndpoint(url);
        request.setMethod('GET');
        HttpResponse response = http.send(request);


that's what i get from system.debug when I check for the request:
System.HttpRequest[Endpoint=https://maps.googleapis.com/maps/api/distancematrix/json?key=......&origins=Via Celano,Avezzano&destinations=Via Roma,Aquila&mode=driving&sensor=false&language=en&units=imperial, Method=GET]
If i paste this string in a browser, it works. 

Already added the endpoint "https://maps.googleapis.com" to remote sites, what should I do? Thanks again