Is there any way to display Geolocation part of Address field type in edit or display mode?
Account object contains specific BillingAddress field of Address type (is in beta). Also, as mentioned here, Address field type contains Location part of Geolocation (latitude, longitude) and many more parts.
All parts are displayed on the Account Page Layout, but Location is hidden (see attachments). Does anybody know how to make it visible and editable?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I agree it is curious there is no obvious way to make this appear in the UI. So for now it is workarounds.
Visible is easy. A workaround could be to create a formula field that took the Lat/Long values and simply displayed them in string format.
TEXT(BillingLatitude) & " , " & TEXT(BillingLongitude)
To have them editable, there are a few ways, such as inline visualforce pages. But maybe a nice clean way would be link to a visualforce page and edit there. In this instance, a basic edit page might look as follows:
<apex:page standardController="Account" > <apex:form> <apex:pageBlock mode="edit"> <apex:pageBlockButtons> <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection> <apex:inputField value="{!Account.BillingLatitude}"/> <apex:inputField value="{!Account.BillingLongitude}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Then you would change the formula field to add a link as follows:
TEXT(BillingLatitude) & " , " & TEXT(BillingLongitude) & " " & HYPERLINK("apex/AccountGeolocation?id="&Id&"&retURL=%2f" & Id ,"(Change)", "_self")
And that gets you page flow that mirrors the user experience for editing ownership, and record type:
There are certainly other bells and whistles you might want to add. For instance you could stick some Javascript in your geolocation page to use the geo api and get it from the device the user is using. But this should get you started.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0