4

Creating a custom link to a Google Maps page with the billing address of an account marked. Simple task, no?

Anyway what I have entered is apparently not a valid URL:

http://maps.google.com/maps?q={!Account.BillingAddress}

I tried surrounding it with URLENCODE(), and I checked the documentation and discovered Salesforce does this automatically if you select URL as the content source. So what's up with this?

The syntax checker says it's all good, but when I go to save it says:

Error: Enter a URL that is valid and well-formed

3
  • I'd say if this is a valid URL depends on the content of the BillingAddress field. What's the context in which you are using this snippet?
    – FrankZ
    Commented Jul 9, 2014 at 11:01
  • In the content section of a new custom link on the account object. I have managed to get it working using the separate fields but if Salesforce are going to add a composite field like BillingAddress they should really make it work with things.
    – Adam
    Commented Jul 9, 2014 at 11:03
  • 1
    Account.BillingAddress is in beta. See salesforce.com/us/developer/docs/api/Content/…
    – David Renz
    Commented Jul 9, 2014 at 11:47

2 Answers 2

2

I tried it on an easy Visualforce page and it failed also.

<apex:page standardController="Account">
    <apex:outputText >{!Account.BillingAddress}</apex:outputText>
</apex:page>

It fails, because BillingAddress is not just a text field, it is a group of fields. You can see it if you query it.

Query of Account.BillingAddress

You have to try something like this:

http://maps.google.com/maps?q={!Account.BillingCity}&{!Account.BillingStreet}&...

Account.BillingAddress is in beta, so don't expect too much.


Source: Account Docs


2

Create a formula field of type text and use something like this formula:

HYPERLINK("http://maps.google.com/maps?q=" & BillingStreet & ",+" & BillingCity & "+" & BillingState & "+" & BillingPostalCode, "To see map click here")

That works for me. It seems you can't use BillingAddress - at least not right now.

1
  • Yes that would be a great solution for that problem.
    – David Renz
    Commented Jul 9, 2014 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .