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
ScotScot 

Errors with the new sample Google Maps sControl

I'm trying to implement the sample Google Maps S-Control, and not having much luck.

I'm about ready to abandon the idea, but thought I'd check for some assistance first.

I'm referring to the sample s-Control which does not require your own server, and is described at:
    http://salesforce.breezecentral.com/buildgmaps/

I've followed the proscribed steps of:
   > Adding two custom fields to Account, Contact, and Lead
   > Building the sControl from the sample code
   > Creating a Web tab
   > Configuring the browser to allow "Access data sources across domains"

When I open the page, I get:

   > Pop-up message:
"The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://www.google.com/apis/maps"

   > Errors displaying the page:
"Line 721, char 2, Error: 'GIcon' is undefined, Code 0
URL: https://ssl.salesforce.com/servlet/servlet.Integration?lid=01N00000000007b&enc-UTF-8
Line 736, char 1, Error: 'GMap' is undefined, Code 0
URL: https://salesforce.com/servlet/servlet.Integration?lid=01N00000000007b&enc-UTF-8

   > The dialogs (e.g. picking criteria and searching) don'e function.

I tried the api page mentioned in the message but, if I'm reading this right, it appears that I'd need to apply for an api key for one of the salesforce.com urls?

Any thoughts gratefully accepted.

Scot


Updated the first link, and removed links which are just text.

Message Edited by Scot on 07-27-2005 05:53 PM

DevAngelDevAngel

Hi Scott,

How are you running the control?  From the file system or as an scontrol in the page?

If you are running from your file system, it won't work.  Google will not allow an api key to be registered using a file url.  The best thing to do to run this outside of salesforce.com is to create a url on your local host like "http://localhost/ajax/beta1 and put the scontrol page into that.

The script should have a key for that url in it.  The alternative is to download all the scripts and run them locally (again using localhost) or run from inside the app.

Cheers

ScotScot

Dave,

I'm running the scontrol from within the sf.com UI -- as a web tab.

(This would, if it worked, allow any of my users to access the page without configuration other than allowing cross-domain data access.  I'm following the instructions given on the crmsuccess Web site, and as explained to us at the recent new york user group).

Scot

SuperfellSuperfell
DevAngel - does the script has a google key for each instance, or just na1, the request above is from ssl.salesforce.com
ScotScot

Simon ... Good call.

The problem did appear to be the ssl ...
The script did have a google key for each instance, but "ssl" did not trigger the appropriate code.

I've tested a newer version, from Dave, which no longer produces this error.  I'm not sure that this newer version is posted back to the public page yet.

Scot

Rachael ORachael O
Hi,
I'm trying to implement the Google maps functionality as Benji describes in his tutorial as well.
It appears that my lat/lons are not populating at lead/contact/account level, resulting in an [object Error] prompt. I've set the IE settings to enable data pass-thru as directed, so not sure what's happening or why. It's also displayed as a web tab with the scontrol within the application.

Any advice out there?
Thanks,
Rachael
ScotScot

I've had the same problem (as have some people in the crmsuccess forum), and found that a temporary fix is to eliminate the lat/lon fields - or even just the lat field.

The result is that the feature works ... but needs to retrieve the lat/lon values each time the map is displayed.  So it's really just a patch until we find someone to fix the sample sControl.

Rachael ORachael O
Ok - thanks I will remove lat and see what happens.
MarkerVMarkerV

I'm having a similar problem.  Followed the presentation, but getting "Search complete, no records found" no matter what I search for.  I tried removing the lat fields, but that didn't seem to make a change.  I get no results whether I do a search or a filter.

Any ideas on how to troubleshoot/fix this thing?

Message Edited by MarkerV on 08-26-2005 03:35 PM

Eric_SantiagoEric_Santiago
I get the same error as MarkerV.

Followed the instructions to the letter. (Following a Breeze presentation is a no-brainer. I wish all the apps I worked with came with such well-made instructions.) So on the Web Tab I get a nice google map but no leads, contacts, or accounts. I made the long/lat feilds visible on the accounts profile and noticed they were blank. I assume that they should have been filled in by the sforce control. Correct?

Is there an error log in Salesforce? Perhaps I can investigate further.
DevAngelDevAngel

The Google maps scontrol can be run in a diagnostics mode.  All you need to do is change the following line in the scontrol code from :

var diagnostics = "off";  to var diagnostics = "on";

Reload the scontrol and you will see a button on the lower right hand corner of the map.  Click this and a couple of windows will show below the map to provide more info.

Eric_SantiagoEric_Santiago
Diagnostic info is;

////////////////////////
SOQL/SOSL Text:
////////////////////////
Describe Lead: 0
Describe Contact: 0
Describe Account: 0
Initial query setup.

SOQL: Select id, lastname, firstname, street, city, state, postalcode, company, title, website, email, lat__c, lon__c, Phone, MobilePhone, Fax, CreatedDate from lead where (City != Null) and (IsConverted = false) and (CreatedDate >= 2005-08-29T17:43:41-04:00)
No records matched the query.

SOQL: Select id, lastname, firstname, street, city, state, postalcode, company, title, website, email, lat__c, lon__c, Phone, MobilePhone, Fax, CreatedDate from lead where (City != Null) and (IsConverted = false) and (CreatedDate >= 2005-08-27T19:43:47-04:00)
No records matched the query.

SOQL: Select id, Name, BillingCity, BillingCountry, BillingPostalCode, BillingState, BillingStreet, type, numberofemployees, website, lat__c, lon__c, Phone, Fax, Name from account where (BillingCity != Null)
No records matched the query.

////////////////////////
Web Service call timings:
////////////////////////
Initializing...
describe: 0.297
getPhoneFields: 0
describe: 0.016
describe: 0.063
getPhoneFields: 0
describe: 0.297
getPhoneFields: 0
query: 0.438
query: 0.547
query: 0.25
////////////////////////

The queries seems correct. I played around with the values, with no results though. The only thing odd to me are the field names for lon and lat, which in the instructions were simple that, long and lat. While in the query they are lon_c and lat_c.
DevAngelDevAngel

Might be browser security issues.  IE is pretty silent and it won't work in firefox due to security.

Recheck the instructions, particularly related to security.

Eric_SantiagoEric_Santiago
I was using firefox 1.0.6 but also tried IE making sure. I set Enable data sources across domains for the Internet zone. I even made sure I downloaded the latest Java runtime. But no luck.

One thing I did notice is the security certificate from sandbox.sforce.com expired 10/18/2005. When I try intalling it in IE, close IE down, and go back to gmap control I get prompted to install each time. Viewing the cert I noticed the expired date.

Did you say this control doesn't work in Firefox at all? It didn't mention that in the intructions. That would be really unfortunate.
Eric_SantiagoEric_Santiago
I figured out what was wrong. I was using the query all "X created in last 2 years" According to another post http://forums.sforce.com/sforce/board/message?board.id=general_development&message.id=4677 there is something wrong in the date format. Sure enough doing a search for a specific contact worked. BTW it worked in both IE and Firefox without fail.
DevAngelDevAngel

First, the sandbox machine has a developer cert that is not valid, and you should not deploy to users using that lib as it truly is a sandbox and will not represent the most recent stable version.

You should be able to run the scontrol using IE once you get your security properly configured.  Try adding maaps.google.com to your trusted sites.  The way the control works is that when it retrieves data that has no values in the lat and lon fields, it uses another site to geocode the data.  The lat lon that results is stored back to the record.  The next time that record is returned in a search, it doesn't need to be geocoded again so it does not have to do the cross domain geocoding. 

For firefox, unfortunately, you cannot adjust the security to allow the geocoding.  This means that if the records have been geocoded already, they will display perfectly in firefox, otherwise they just won't show up.

We know that is a little wierd, but this is a sample.  One day maybe having addresses automatically geocode when entered in salesforce.com will be a reality and this "little" caveat won't apply.

DevAngelDevAngel
Read my previous response to understand the firefox issue.
MarkerVMarkerV

Full Results of the diagnostics are below, but particularly this:

getString(http://maps.google.com/maps?output=js&q=1530 16th Street,Denver,CO ): [object Error] - Permission denied
Skipping geocoding of GMAP GMAP due to error [object Error] - Unspecified error

What is the deal with the "[Object Error] - Permission denied"?

Just noticed...the getString string, breaks the URL after the street number, does it have anything todo with URL encoding?  Does there need to be a %20 to account for the spaces or something?

I created a Contact named GMAP GMAP (first name last name) and an account called "GMAP Family".  Address is the 16th street one you see above, so it appears to be finding the records, but not mapping.

 

Describe Lead: 0
Describe Contact: 0.01
Describe Account: 0.01
Initial query setup.

SOQL: Select id, lastname, firstname, street, city, state, postalcode, company, title, website, email, lat__c, lon__c, Phone, MobilePhone, Fax, HomePhone__c, CreatedDate from lead where (City != Null) and (IsConverted = false) and (CreatedDate >= 2005-08-30T07:47:20
No records matched the query.

SOSL: FIND {GMAP}  RETURNING Case(ContactId), Contact(Id), Account(ID), Lead(Id)

RETRIEVE ACCOUNT: {id, Name, BillingCity, BillingCountry, BillingPostalCode, BillingState, BillingStreet, type, numberofemployees, website, lat__c, lon__c, Phone, Fax}

In retrieve callback.
Using google scraping...
Skipping geocoding of GMAP Family due to missing address data.
Couldn't create address for: Account - GMAP Family


RETRIEVE CONTACT: {id, lastname, firstname, mailingstreet, mailingcity, mailingstate, mailingpostalcode, accountid, title, email, lat__c, lon__c, Phone, Fax, MobilePhone, HomePhone, OtherPhone, AssistantPhone, HomePhone1__c}

In retrieve callback.
Using google scraping...
getString(http://maps.google.com/maps?output=js&q=1530 16th Street,Denver,CO ): [object Error] - Permission denied
Skipping geocoding of GMAP GMAP due to error [object Error] - Unspecified error
.
Couldn't create address for: Contact - GMAP

Message Edited by MarkerV on 08-30-2005 09:06 AM

DevAngelDevAngel
Permission Denied means that your browser does not have permission to do the geocode lookup.
MarkerVMarkerV

Is that referring to the Access Data Sources Across Domains setting?  I've double checked that setting is enabled...

How do I "Get" that permission to access geocodes?  I'm using IE.  What am I missing?

Thanks for the help.

Message Edited by MarkerV on 08-30-2005 01:11 PM

DevAngelDevAngel

Check the url of the page that your gmap scontrol is hosted on.  If it is https://na1.salesforce.com... then add https://na1.salesforce.com as a trusted site in the security tab of ie options.  For the trusted sites, set the enable the Access data sources across domains setting.

That should do the trick.

MarkerVMarkerV

No dice...same error:

[object Error] - Permission denied

My url is na1.salesforce.com, and tried adding https://na1.salesforce.com as well as https://*.salesforce.com as trusted sites and verified the security setting is set properly.

Could/does it have anything to do if my lat/lon fields are visible in page views or not?  I'd can't believe that has anything to do with it, but just don't see what I'm doin' wrong.

 

Thanks for you help..

DevAngelDevAngel
Nope, it has nothing to do with FLS.  Must some other security setting, but the only way I could duplicate it was the reverse of the instuctrions I gave you.
MarkerVMarkerV
Thanks for all the help.  I guess I'll have to abandon this until it's supported by SF.com.  It'd be pretty cool (and usefull), but I dropped my security to about nothing and still get the same error...
Boulder MikeBoulder Mike
I was having a problem too, but I noticed while using the Diagnostic Mode, that the SOQL generated by the S-Control has a bit of a problem.

For example, I was trying to search for Accounts with BillingPostalCode = '80301'. The SOQL generated had listed the BillingPostalCode field _twice_, since it's one of the standard fields returned in every search.

When I tried searching on a custom field, the s-control worked great, both from IE and Firefox.

Michael
sForcePersonsForcePerson
Dev Angel,

Any Luck so far. I relaxed all the security in IE and still I am not able to
get the things working. It is retrieving one record, but with the following
complaint as not able to map.

Initial query setup.

SOQL: Select id, lastname, firstname, street, city, state, postalcode, company, title, website, email, Phone, MobilePhone, Fax, CreatedDate from lead where (City != Null) and (IsConverted = false) and (CreatedDate >= 2005-10-17T09:16:48-04:00)
The query located 1 records.
Using google scraping...
getString(http://maps.google.com/maps?output=js&q=29 Constable Rd,Kendall Park,NJ ): [object Error] - Permission denied
Skipping geocoding of LeadName due to error [object Error] - Unspecified error
.
0 addresses out of 1 where mappable.
sForcePersonsForcePerson
I found the problem and fixed it. It is strange though. I was running XP SP1
during my initial phase of the development when encountering this permission
denied problem. After I upgraded to SP2, everything works seamlessly. :-)
Funny though......
DevAngelDevAngel
Yes, ha ha (thanks Bill G.)
Bryan WagstaffBryan Wagstaff
Not funny to me. :-/

Not everybody runs IE6 SP2.

There are the issues with firefox (discussed earlier), as well as similar problems with other web browsers.

Given the portability and security issues, I wonder if anybody has tried it on the IE7 betas yet.

Bryan.
FrontlineCRMFrontlineCRM
See this post from DevAngel for the latest Google Maps S-Control code:

http://forums.sforce.com/sforce/board/messageboard.id=general_development&message.id=6230

Message Edited by FrontlineCRM on 02-14-2006 04:07 PM

Message Edited by FrontlineCRM on 02-14-2006 04:08 PM