• agrassi
  • NEWBIE
  • 20 Points
  • Member since 2010


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 13
    Replies
Our application uses the OpenCTI runApex() method to communicate with the backend. It works well in Lightning on our DE orgs.

But then we uploaded a package and installed it in another org. There we created an application with the CTI toolbar enabled. This org has My Domain enabled, and we used the absolute URL in the Call Center definition. All right?

The application loads, but fails when communicating with the backend with the OpenCTI runApex() method.

After some research, we found out that no requests are sent at all over the network. So it's not that the server fails to respond or there's some protocol/communication issue. But basically, the network request isn't dispatched at all.

Any feedback here? Are we aware of any issue with the runApex() method when in Lightning and in a packaged context? Again, this works OK in Lightning when testing in our dev environments (i.e., in a non-packaged context).

Thanks very much!
We have a working implementation of FastCall running on Lightning Open CTI. So we want to deliver it to our subscribers, and if possible include the Lightning app with "Open CTI Softphone" option enabled. Since we already include the appropriate Call Center to work in lightning as well.

We are able to package the Lightning app, but we can't find the way to package it with Softphone enabled (i.e., avoid having to check "OpenCTI Softphone" under the App Manager > Our App > App Options).

Doing some research over the new metadata components we found that the Lightning apps have a new property CtiUtilBar and that CtiUtilBar is a FlexiPage component that seems to be created by the platform when Lightning is enabled.

We tried packaging the app with <utilityBar>CtiUtilBar</utilityBar> but when it's installed in the subscriber's org, the Softphone is not enabled, and it is not possible to enable the option by hand because the app component is managed.

Maybe Salesforce doesn't support what we want to in this release of Lightning OpenCTI? If so, what would you recommend in this case, subscribers have to manually create the Lightning app and enable the softphone?

Thanks for your answers & feedback!

Hello. I have a Force.com Site domain configured, and a Force.com site. The Force.com Site domain shows under Domains > My Domains. I can query the Site object, and it has the proper SubDomain value.

According to the docs, I should be able to query the Domain object and find this Force.com Sites domain. Also, there should be a DomainSite record linking the Site to the Domain. Right?

I query both the Domain and DomainSite objects (as a System Administrator), and both queries return no results.

I want to check, from Apex code (or using the Metadata API or something) whether there's a Force.com Sites domain set already on the org, and it's sub-domain component. Even when there are no sites created (I guess in that case I could query for a Site record with Type = Force.com Site, and use the SubDomain value?).

The final objective here, is being able to programatically create a Force.com Site. We intend to use the Metadata API for doing this.

Any ideas? Thanks!

  • September 28, 2016
  • Like
  • 1
Today I enabled all critical updates in one of my orgs, and then switched from Classic to Lightning. The "fireworks" loading page shows but never finishes. In the browser console I have the following:
Application Cache Error event: Manifest fetch failed (4) https://fastcall-test1-dev-ed.lightning.force.com/l/%7B%22mode%22%3A%22PROD…A%22NN%22%7D/app.manifest?aura.attributes=%7B%22source%22%3A%22aloha%22%7D
/one/one.app?source=aloha#/sObject/UserAppMenuItem/home:1

​Refused to connect to 'https://fastcall-test1-dev-ed.my.salesforce.com/visualforce/session?url=htt…1-dev-ed.lightning.force.com%2F_ui%2Fsystem%2Fcontext%2FUserContextServlet' because it violates the following Content Security Policy directive: "connect-src 'self' https://api.bluetail.salesforce.com https://preprod.bluetail.salesforce.com https://staging.bluetail.salesforce.com https://na15.salesforce.com".

/one/one.app?source=aloha#/sObject/UserAppMenuItem/home:1 [Report Only] Refused to connect to 'https://fastcall-test1-dev-ed.my.salesforce.com/visualforce/session?url=htt…1-dev-ed.lightning.force.com%2F_ui%2Fsystem%2Fcontext%2FUserContextServlet' because it violates the following Content Security Policy directive: "connect-src 'self'".
The best thing is that I cannot switch back to Classic, as the top right menus are never rendered. So my org is f****d !?!?

Using Chrome version 52.0.2743.116 (64-bit)
 
Hello everyone. The third parameter bellow is a promise, that when resolved or rejected will execute a callback function. 
There I receive Maximum call stack size exceeded when Locker service is active.
 
var dataService = {
request : $A.getCallback(function(actionName, params, defer) {
    
    var componentActionName = 'c.' + actionName;
    var action = component.get(componentActionName);
    
    action.setParams(params);
    
    action.setCallback(this, function(a) {
        try {
            
            var state = a.getState();
            if (state === 'SUCCESS') {
                defer.resolve(a.getReturnValue());
            }
            else if (state === 'ERROR') {
                var errors = a.getError();
                if (errors) {
                    defer.reject(errors[0].message);
                } else {
                    defer.reject('Lightning server side unknown error');
                }
            }
        } catch (ex) {
            console.log('### Exception: ');
            console.log(ex);
        }
    });
    
    $A.enqueueAction(action);
    
})

Any idea on what might be going on?

Thanks!
On a Lightning Component, when calling an action on the Apex back-end using $A.enqueueAction(...), it takes a whileee to complete (up to 30 secs!). The action in the back-end is just a simple DML.

By reading the docs and inspecting the browser network debug logs, we understand this is because the actions are hold in a queue till some sort of poller/spooler thread processes it and dispatches these all together to the backed.

- Is there a way to execute actions inmediately, without enqueuing? Or control the frequency of the dispatching job?
- Or is it that we are something wrong, and $A.enqueueAction(...) is not the correct way to invoke an @AuraEnabled Apex method?

Thanks a lot!
Hi. I'm using SFDC's REST API to access org data. According to the docs (https://www.salesforce.com/us/developer/docs/api_rest/Content/headers_api_usage.htm), each request to the REST API should return a Sforce-Limit-Info header stating the the amount of API requests used, and the amount of remaining requests (on the 24 hours period).

I used curl to perform a test request to the "versions" REST resource, something like this
curl https://naxx.salesforce.com/services/data/ -H 'Authorization: Bearer accesstoken'
The first request returned the Sforce-Limit-Info header
HTTP/1.1 200 OK
Date: Mon, 20 Oct 2014 15:02:23 GMT
Set-Cookie: BrowserId=w-h7pI5DQoKtCV3miixgiw;Path=/;Domain=.salesforce.com;Expires=Fri, 19-Dec-2014 15:02:23 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Sforce-Limit-Info: api-usage=2/15000
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Then I performed the same exact request again, but this one didn't return the header.
HTTP/1.1 200 OK
Date: Mon, 20 Oct 2014 15:39:14 GMT
Set-Cookie: BrowserId=jxsxeMkhRnWczTOVIjCoSA;Path=/;Domain=.salesforce.com;Expires=Fri, 19-Dec-2014 15:39:14 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Subsequent requests do not return the header either.

Anyone has experienced this issue?
 

Hi all. I'm having a problem accessing the REST API from a VF page. Basically, the request performs OK, except for the parameters, which are not being set/do not arrive on the endpoint.

 

I'm using forcetk to avoid the cross domain issue. This is the relevant VF code:

 

<apex:page showHeader="false" sidebar="false" standardStylesheets="false">

    <apex:includeScript value="{!URLFOR($Resource.MyResource, 'jquery-1.9.1.min.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.MyResource, 'forcetk.js')}"/>
    
    <script type="text/javascript">
        $(document).ready(function() {

            var forceTKClient = new forcetk.Client();
            forceTKClient.setSessionToken('{!$Api.Session_ID}');
            
            forceTKClient.apexrest(
                '/MyRestResource',
                function(data, textStatus, jqXHR) {
                    console.log('SUCCESS - ' + data);
                },
                function(jqXHR, textStatus, errorThrown) {
                    console.log('ERROR - ' + textStatus);
                },
                'GET',
                {'myParameter':'myValue'},
                null,
                false
            );
        });
    </script>
    
</apex:page>

 

And this is the Apex controller for the REST resource:

 

@RestResource(urlMapping='/MyRestResource')
global with sharing class MyRestResource {
    
    @HttpGet
    global static Map<String, String> doGet() {

        Map<String,String> res = new Map<String,String> {
            'received' => 'yes'
        };      
        
        res.putAll(RestContext.request.params);
        return res;
    }

}

 

My custom REST method is reached correctly, and the response from it is returned correctly, but the parameters do never get to my custom REST method. I.e., the response received on the JS callback is

 

{received: "yes"}

 whereas it should be

 

{received: "yes", myParameter: "myValue"}

Inspecting the request sent from the browser I see that the endpoint is

 

https://c.na11.visual.force.com/services/proxy?_=1368023886976

 

 

"myParameter" isn't present anywhere on the browser request.

 

Any hint?

 

Thanks in advance,

Antonio

 

 

When we create an Event involving another attendee (from the SF web UI for example), SF creates one Event record for each attendee. And then it adds one entry per attendee on the EventAttendee table, linking/poinint to the first/main record.

 

Example:

 

I login as U1, click on "New Event" in my homepage, add U2 as attendee for the event and save. This will create two Event records: E1 owned by U1 and E2 owned by U2. And it will add (U1, E1) and (U2, E1) on the EventAttendee object.

 

My question is: how do I programmaticaly know if two Event records "are the same event". Having two events E1 owned by U1 and E2 owned by U2, I've no exact way of telling if E2 is the Event record instance created for U2 as result of him being an attendee when U1 scheduled E1.

 

I've seen the IsGroupEvent field on the Event object which doesn't help much.

 

I tried catching E1 and E2 using a trigger and trying to relate in there, but (surprise!) when I save and then I check the logs, the trigger is only executed for E1. No visible trace of E2 on the logs, but SF is creating it and it exists.

 

I could apply some heuristics and say something like: if I've E2 owned by U2, U2 appears on EventAttendee pointing to E1, and E2 and E1 have the same date & subjects, then assume they're different records "of the same event".

 

But maybe there's something more direct/exact?

 

This is related to this previous post.

 

Any hint? Thanks a lot!

 

Antonio

Hello everyone. We've a scheduled job that creates Event records. Particularly, some of these records are recurrent events. I've been receiving exceptions like the following when upserting records:

 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Based on the frequency you selected, the end date cannot be after 18/05/2012.: End Date: [RecurrenceEndDateOnly]

 

 A couple of comments:

 

  • RecurrenceEndDateOnly is a required field (infinite recurrence isn't supported)
  • The maximum RecurrenceEndDateOnly depends, not only on the RecurrenceStartDateTime, but olso on the frequency kind, interval, and other values of the Event, as changing the recurrence details while creating a recurring event from the SF UI, will show a different max date if you click on the "calculate max end time" link (seems like event records are actually created for all instances, from time zero, nice)

 

I've been searching the docs for a way to determine the RecurrenceEndDateOnly max value, from within my Apex code, without success.

 

My question is: does anyone know how is this value calculated? Is there a class method or at least the formula to implement this on my side?

 

Thanks a lot,

 

Antonio

Hello all!

 

I'd like to expose some of our org's functionality through a custom REST API. It would be a set of VF pages published in a Force.com site. Those pages would return JSON encoded data.

 

My question is: how do I know the method used to request the VF page, from inside its Apex controller? I.e., was it a GET, POST, DELETE, etc?

 

Thanks in advance,

Antonio

Hello everyone. I would appreciate any help regarding this situation:

 

 

  • Two orgs A and B sharing Leads across a S2S connection (bi-directional)
  • A set of assignment rules defined on org B
When a shared Lead is updated in org A, the changes are correctly propagated to org B, but the assignment rules are not executed on org B for this updated Lead.
Now:
  • When editing by hand, there's a checkbox that says "Assign using active assignment rule".
  • When updating from Apex, we can set the Database.DMLOptions.assignmentRuleHeader.useDefaultRule to true, to have the assignment rule applied after the record update.
My question is:
is there any way to have the assignment rules in org B executed, when I update the Lead in org A?
When editing by hand, checking "Assign using active assignment rule" applies the rules and performs any ownership change in the LOCAL org. Does the Database.DMLOptions.assignmentRuleHeader.useDefaultRule have any effect when updating through S2S?
Thanks,
Antonio

 

 

Hello. I have a Force.com Site domain configured, and a Force.com site. The Force.com Site domain shows under Domains > My Domains. I can query the Site object, and it has the proper SubDomain value.

According to the docs, I should be able to query the Domain object and find this Force.com Sites domain. Also, there should be a DomainSite record linking the Site to the Domain. Right?

I query both the Domain and DomainSite objects (as a System Administrator), and both queries return no results.

I want to check, from Apex code (or using the Metadata API or something) whether there's a Force.com Sites domain set already on the org, and it's sub-domain component. Even when there are no sites created (I guess in that case I could query for a Site record with Type = Force.com Site, and use the SubDomain value?).

The final objective here, is being able to programatically create a Force.com Site. We intend to use the Metadata API for doing this.

Any ideas? Thanks!

  • September 28, 2016
  • Like
  • 1

Hello. I have a Force.com Site domain configured, and a Force.com site. The Force.com Site domain shows under Domains > My Domains. I can query the Site object, and it has the proper SubDomain value.

According to the docs, I should be able to query the Domain object and find this Force.com Sites domain. Also, there should be a DomainSite record linking the Site to the Domain. Right?

I query both the Domain and DomainSite objects (as a System Administrator), and both queries return no results.

I want to check, from Apex code (or using the Metadata API or something) whether there's a Force.com Sites domain set already on the org, and it's sub-domain component. Even when there are no sites created (I guess in that case I could query for a Site record with Type = Force.com Site, and use the SubDomain value?).

The final objective here, is being able to programatically create a Force.com Site. We intend to use the Metadata API for doing this.

Any ideas? Thanks!

  • September 28, 2016
  • Like
  • 1
Hello everyone. The third parameter bellow is a promise, that when resolved or rejected will execute a callback function. 
There I receive Maximum call stack size exceeded when Locker service is active.
 
var dataService = {
request : $A.getCallback(function(actionName, params, defer) {
    
    var componentActionName = 'c.' + actionName;
    var action = component.get(componentActionName);
    
    action.setParams(params);
    
    action.setCallback(this, function(a) {
        try {
            
            var state = a.getState();
            if (state === 'SUCCESS') {
                defer.resolve(a.getReturnValue());
            }
            else if (state === 'ERROR') {
                var errors = a.getError();
                if (errors) {
                    defer.reject(errors[0].message);
                } else {
                    defer.reject('Lightning server side unknown error');
                }
            }
        } catch (ex) {
            console.log('### Exception: ');
            console.log(ex);
        }
    });
    
    $A.enqueueAction(action);
    
})

Any idea on what might be going on?

Thanks!
Hi. I'm using SFDC's REST API to access org data. According to the docs (https://www.salesforce.com/us/developer/docs/api_rest/Content/headers_api_usage.htm), each request to the REST API should return a Sforce-Limit-Info header stating the the amount of API requests used, and the amount of remaining requests (on the 24 hours period).

I used curl to perform a test request to the "versions" REST resource, something like this
curl https://naxx.salesforce.com/services/data/ -H 'Authorization: Bearer accesstoken'
The first request returned the Sforce-Limit-Info header
HTTP/1.1 200 OK
Date: Mon, 20 Oct 2014 15:02:23 GMT
Set-Cookie: BrowserId=w-h7pI5DQoKtCV3miixgiw;Path=/;Domain=.salesforce.com;Expires=Fri, 19-Dec-2014 15:02:23 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Sforce-Limit-Info: api-usage=2/15000
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Then I performed the same exact request again, but this one didn't return the header.
HTTP/1.1 200 OK
Date: Mon, 20 Oct 2014 15:39:14 GMT
Set-Cookie: BrowserId=jxsxeMkhRnWczTOVIjCoSA;Path=/;Domain=.salesforce.com;Expires=Fri, 19-Dec-2014 15:39:14 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Subsequent requests do not return the header either.

Anyone has experienced this issue?
 

Hi all. I'm having a problem accessing the REST API from a VF page. Basically, the request performs OK, except for the parameters, which are not being set/do not arrive on the endpoint.

 

I'm using forcetk to avoid the cross domain issue. This is the relevant VF code:

 

<apex:page showHeader="false" sidebar="false" standardStylesheets="false">

    <apex:includeScript value="{!URLFOR($Resource.MyResource, 'jquery-1.9.1.min.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.MyResource, 'forcetk.js')}"/>
    
    <script type="text/javascript">
        $(document).ready(function() {

            var forceTKClient = new forcetk.Client();
            forceTKClient.setSessionToken('{!$Api.Session_ID}');
            
            forceTKClient.apexrest(
                '/MyRestResource',
                function(data, textStatus, jqXHR) {
                    console.log('SUCCESS - ' + data);
                },
                function(jqXHR, textStatus, errorThrown) {
                    console.log('ERROR - ' + textStatus);
                },
                'GET',
                {'myParameter':'myValue'},
                null,
                false
            );
        });
    </script>
    
</apex:page>

 

And this is the Apex controller for the REST resource:

 

@RestResource(urlMapping='/MyRestResource')
global with sharing class MyRestResource {
    
    @HttpGet
    global static Map<String, String> doGet() {

        Map<String,String> res = new Map<String,String> {
            'received' => 'yes'
        };      
        
        res.putAll(RestContext.request.params);
        return res;
    }

}

 

My custom REST method is reached correctly, and the response from it is returned correctly, but the parameters do never get to my custom REST method. I.e., the response received on the JS callback is

 

{received: "yes"}

 whereas it should be

 

{received: "yes", myParameter: "myValue"}

Inspecting the request sent from the browser I see that the endpoint is

 

https://c.na11.visual.force.com/services/proxy?_=1368023886976

 

 

"myParameter" isn't present anywhere on the browser request.

 

Any hint?

 

Thanks in advance,

Antonio

 

 

When we create an Event involving another attendee (from the SF web UI for example), SF creates one Event record for each attendee. And then it adds one entry per attendee on the EventAttendee table, linking/poinint to the first/main record.

 

Example:

 

I login as U1, click on "New Event" in my homepage, add U2 as attendee for the event and save. This will create two Event records: E1 owned by U1 and E2 owned by U2. And it will add (U1, E1) and (U2, E1) on the EventAttendee object.

 

My question is: how do I programmaticaly know if two Event records "are the same event". Having two events E1 owned by U1 and E2 owned by U2, I've no exact way of telling if E2 is the Event record instance created for U2 as result of him being an attendee when U1 scheduled E1.

 

I've seen the IsGroupEvent field on the Event object which doesn't help much.

 

I tried catching E1 and E2 using a trigger and trying to relate in there, but (surprise!) when I save and then I check the logs, the trigger is only executed for E1. No visible trace of E2 on the logs, but SF is creating it and it exists.

 

I could apply some heuristics and say something like: if I've E2 owned by U2, U2 appears on EventAttendee pointing to E1, and E2 and E1 have the same date & subjects, then assume they're different records "of the same event".

 

But maybe there's something more direct/exact?

 

This is related to this previous post.

 

Any hint? Thanks a lot!

 

Antonio

Hello everyone. We've a scheduled job that creates Event records. Particularly, some of these records are recurrent events. I've been receiving exceptions like the following when upserting records:

 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Based on the frequency you selected, the end date cannot be after 18/05/2012.: End Date: [RecurrenceEndDateOnly]

 

 A couple of comments:

 

  • RecurrenceEndDateOnly is a required field (infinite recurrence isn't supported)
  • The maximum RecurrenceEndDateOnly depends, not only on the RecurrenceStartDateTime, but olso on the frequency kind, interval, and other values of the Event, as changing the recurrence details while creating a recurring event from the SF UI, will show a different max date if you click on the "calculate max end time" link (seems like event records are actually created for all instances, from time zero, nice)

 

I've been searching the docs for a way to determine the RecurrenceEndDateOnly max value, from within my Apex code, without success.

 

My question is: does anyone know how is this value calculated? Is there a class method or at least the formula to implement this on my side?

 

Thanks a lot,

 

Antonio

Hi everyone,

 

I am in a visualforce page with a Controller. I have a list and a command button in this page.

 

<apex:selectList id="country" value="{!cdt.Country__c}" size="1"> <apex:selectOptions value="{!Values}"></apex:selectOptions> </apex:selectList><apex:commandButton action="{!test}" value="{!$Label.btn_Save}" />

 

When I call the commandButton, the list method getValues is called BEFORE the test method.

Several questions then:

- why is it called at all? It is part of the initialization of the page and shouldn't be called when we call an action! My intuition is that it is part of the validation that is automatically called by Salesforce when we call an action. But I don't see any reason why

-  It seems that it fires the Heap size verification. And the only solution we found to control the heap size of a page (for example when you want to upload big files) is to put null in the variable holding the big data when you don't need them, which is at the end of the action method. But if this verification is fired BEFORE this action then this solution doesn't work anymore.

 

Any thoughts?

 

Laurent