• someone
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 12
    Replies
I have some contacts that have their phone numbers stored in e164 format (e.g. +18885551234). If I execute the below search with a phone param of 8885551234, the query returns nothing. Why is that?
 
String queryStr = 'FIND {*' + ph + '} IN Phone FIELDS RETURNING Contact(Phone, FirstName, LastName)';

 
I have a call center app which makes use of the open CTI library. What is the best way to import this javascript file if the host is essentially a variable and can change for each login. For example, na15 may change in the future:
<script src="https://na15.salesforce.com/support/api/31.0/interaction.js"></script>

So is it best to download this file and host locally?



 
I have a call center application running in salesforce. This web-app is loaded inside an iframe within salesforce. The app uses the openCTI javascript library to interact with salesforce data. It was recently noticed that if the user navigates within salesforce, the browser will double up the navigation history. For example, if the users navigates to Accounts > Contacts > Leads, then the browser history will look like:
- Leads
- Contacts
- Contacts
- Accounts
- Accounts

Since there is only one of Leads at the end of this scenario, perhaps one history entry is added when the page is loaded, and another when the page unloaded. In any case, I have no idea why this is. If I point the call center to load a simple html page outside my app, then the history functionality is fine, so the cause is something do with my app, but I'm not sure if its some source from the openCTI library (interaction.js) used by my app or something else within my code. My app does not touch the browser history explicitly. Any ideas? Thanks.
Is there a way to retrieve the currently logged in salesforce username using openCTI?
I have a search function that should query for a List<Cases>, and then a List<Opportunities>, then merge both collections and return the final list as a JSON serialized string. Apex SOQL does not allow me to query for a List<Object> to make the lists more generic before merging them. How can I get around this? Should I handle both lists individually, then merge them after they been serialized to string?
The salesforce edit page for an Activity Task, has a field call "Related To" where the user can select a type of record (i.e. Case, Account, etc) and then use a lookup search feature to bring up some existing records to link the activity to. Is this lookup feature exposed through the openCTI api in any way? Or do I need to write my own search feature?
So I have two apex functions for searching contacts. One searches by name using SOQL, the other searches by phone number using SOSL FIND. I call these apex functions via the openCTI runApex() function. I'm experience the following scenario:
- I have two contacts, with the same first name, originally with the same phone number (e.g. 421-555-1234) 
- I manually change one of the contacts to have a different phone number (421-555-6789), then call the SOQL search function via openCTI,
- The results return correctly (two contacts return with there correct contact details - their individual phone numbers)
- If I call the SOSL find function using the original phone number (421-555-1234), I expect to get back a single record, however both contacts are returned.
- If I wait several minutes and call the same SOSL find function, then I get back a single contact.

So it seems the updated phone number takes time to propagate through the system with respect to SOSL functionality. Why is that?
I have a method to query for a specific Task object (or list of Tasks) based on the ID(s) of the object as follows:
        
webService static String getTasksByIds(String idsAsJson) {
   Set<Id> taskIds = (Set<Id>) JSON.deserialize(idsAsJson, Set<Id>.class); 
   List<Task> tasks = [SELECT Id, IsClosed, Status, Subject, Description, WhoId, Account.Name FROM Task WHERE Id IN : taskIds];
        
   Map<Id, Task> taskMap = new Map<Id, Task>();
   for (Task t : tasks) {
        taskMap.put(t.Id, t);
   }             
   return JSON.serialize(taskMap);
}

How can I also query for the Account object (with Cases, Opportunities, Contracts) and the Contact object all in the same query?

Thanks
I'm inserting a task (call log) object via openCTI and saveLog(). The response comes back with the id of that object. Then at a later time I want to query for details of the object (via an apex class), which works fine, but the id of the object is slighly different in the query response. For example, the first id returned is 00To00000080Ik3, then when I query for the object through an apex class, the id comes back as 00To00000080Ik3EAE (the same id except its postfixed with EAE). What is the postfix and is there a way to get the object with its original id (e.g. 00To00000080Ik3).

Thanks.
I have an openCTI app embedded into salesforce. From the app I'd like to call sforce.interaction.screenPop to load specific pages/tab in salesforce (i.e. Leads, Contacts, etc).  I notice that the url to these pages is alphanumeric in nature (e.g. contacts=/003/o) and I'm not certain that they are universal and static. Can someone inform me if this is true and if there is a safe way to link to these pages?
I have an SOSL FIND query to find contacts by phone number:
FIND {*' + phone + '} IN PHONE FIELDS RETURNING Contact(LastName, FirstName, AccountId)';
I'd also like to return the accounts for each contact (if one exists) joining on Contact.AccountId. Is it possible to do in one statement? If not, how would I loop through the results to get the account, and return all in json format?
sforce.interaction.runApex('Search', 'query', 'SELECT FirstName, LastName FROM Contact', function(response){
    console.log(response.result);
});
I'm trying to run the above javascript command for executing methods on Apex system classes: using class Search, calling method query, with the passed query statement, but I get the following error: Could not load Apex class: Search

I was able to call UserInfo.getUserName in a similar fashion without any issues. Not sure why the search class is not found. Any ideas? 

This is the api doc I am using: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_search.htm#apex_System_Search_query

I'm looking for all possible options to query for account, contact, and lead data. I have seen the REST and SOQL API's. I have also seen that other types of data, such as user information, can be queried for using an apex funtion such as:

sforce.interaction.runApex('UserInfo', 'getUserName', '', function(response){
       ...
});

Is there something similar to the above for account/contact/lead data?

Thanks
So I have two apex functions for searching contacts. One searches by name using SOQL, the other searches by phone number using SOSL FIND. I call these apex functions via the openCTI runApex() function. I'm experience the following scenario:
- I have two contacts, with the same first name, originally with the same phone number (e.g. 421-555-1234) 
- I manually change one of the contacts to have a different phone number (421-555-6789), then call the SOQL search function via openCTI,
- The results return correctly (two contacts return with there correct contact details - their individual phone numbers)
- If I call the SOSL find function using the original phone number (421-555-1234), I expect to get back a single record, however both contacts are returned.
- If I wait several minutes and call the same SOSL find function, then I get back a single contact.

So it seems the updated phone number takes time to propagate through the system with respect to SOSL functionality. Why is that?
I have some contacts that have their phone numbers stored in e164 format (e.g. +18885551234). If I execute the below search with a phone param of 8885551234, the query returns nothing. Why is that?
 
String queryStr = 'FIND {*' + ph + '} IN Phone FIELDS RETURNING Contact(Phone, FirstName, LastName)';

 
I have a call center application running in salesforce. This web-app is loaded inside an iframe within salesforce. The app uses the openCTI javascript library to interact with salesforce data. It was recently noticed that if the user navigates within salesforce, the browser will double up the navigation history. For example, if the users navigates to Accounts > Contacts > Leads, then the browser history will look like:
- Leads
- Contacts
- Contacts
- Accounts
- Accounts

Since there is only one of Leads at the end of this scenario, perhaps one history entry is added when the page is loaded, and another when the page unloaded. In any case, I have no idea why this is. If I point the call center to load a simple html page outside my app, then the history functionality is fine, so the cause is something do with my app, but I'm not sure if its some source from the openCTI library (interaction.js) used by my app or something else within my code. My app does not touch the browser history explicitly. Any ideas? Thanks.
Is there a way to retrieve the currently logged in salesforce username using openCTI?
This regards the usage of Open CTI.
We have an Open CTI integration. The softphone component is purely html and JavaScript in the browser, and uses the standard "sforce.interaction" namespace to access the Open CTI API.
In some fairly rare customer circumstances, a call to "sforce.interaction.saveLog" will result in a failure. The returned error string is: "saveLog API method failed unexpectedly". The behaviour is that (obviously) the requested call log is not saved. Also, based on the total lack of network activity regarding this API call, the error is happening entirely within the browser; there is no reaching out to Salesforce at all. Basically, the saveLog API method fails directly within the method, returning the above error string.
What does the error string "saveLog API method failed unexpectedly" really mean? It is incredibly general with no indication as to the underlying issue. What causes this error? Is it bad input data? (Our data looks well formed, and this error is never seen by the vast majority of our users.) Is it a user permissions error? Is it an object permissions error? What is the specific failures that will cause this error?
I have a search function that should query for a List<Cases>, and then a List<Opportunities>, then merge both collections and return the final list as a JSON serialized string. Apex SOQL does not allow me to query for a List<Object> to make the lists more generic before merging them. How can I get around this? Should I handle both lists individually, then merge them after they been serialized to string?
So I have two apex functions for searching contacts. One searches by name using SOQL, the other searches by phone number using SOSL FIND. I call these apex functions via the openCTI runApex() function. I'm experience the following scenario:
- I have two contacts, with the same first name, originally with the same phone number (e.g. 421-555-1234) 
- I manually change one of the contacts to have a different phone number (421-555-6789), then call the SOQL search function via openCTI,
- The results return correctly (two contacts return with there correct contact details - their individual phone numbers)
- If I call the SOSL find function using the original phone number (421-555-1234), I expect to get back a single record, however both contacts are returned.
- If I wait several minutes and call the same SOSL find function, then I get back a single contact.

So it seems the updated phone number takes time to propagate through the system with respect to SOSL functionality. Why is that?
I'm inserting a task (call log) object via openCTI and saveLog(). The response comes back with the id of that object. Then at a later time I want to query for details of the object (via an apex class), which works fine, but the id of the object is slighly different in the query response. For example, the first id returned is 00To00000080Ik3, then when I query for the object through an apex class, the id comes back as 00To00000080Ik3EAE (the same id except its postfixed with EAE). What is the postfix and is there a way to get the object with its original id (e.g. 00To00000080Ik3).

Thanks.