Skip to main content

I’ve put together a really simple Geochart that ‘should’ render a count of Accounts based on BillingCountry and BillingState. No buckets and only default styling used.


The ‘series’ is using the Count function on the Id field, and BillingState and BillingCountry are both in the model. I’ve also tried using BillingCountryCode and BillingStateCode picklist fields instead, but no luck.


I feel like there’s something really simple that I’ve missed, but can’t seem to figure it out. I’ve copied the page xml below - if anyone has any tips I’d greatly appreciate it.


<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account"> <models> <model id="Account" limit="100" query="true" createrowifnonefound="false" sobject="Account" doclone="" type="" orderby="LastViewedDate Desc"> <fields> <field id="Name"/> <field id="CreatedDate"/> <field id="BillingCountry"/> <field id="BillingCity"/> <field id="BillingState"/> <field id="BillingStreet"/> <field id="Id"/> <field id="LastViewedDate"/> <field id="BillingCountryCode"/> <field id="BillingStateCode"/> </fields> <conditions> <condition type="blank" value="null" field="BillingCountry" operator="!=" enclosevalueinquotes="false"/> <condition type="blank" value="null" field="BillingState" operator="!=" enclosevalueinquotes="false"/> </conditions> <actions/> </model> </models> <components> <pagetitle model="Account"> <maintitle> <template>{{Model.labelPlural}}</template> </maintitle> <subtitle> <template>Home</template> </subtitle> <actions> <action type="savecancel"/> </actions> </pagetitle> <skuidvis__geochart model="Account" maintitle="{{Model.labelPlural}}" maptype="us-all" height="600px" backgroundcolor="#9bc6cf" nullcolor="#eee" rbwidth="0" dlcolor="black" dlbold="false" dlstrokewidth="0" mapgroup="na" dlformat=""> <colors> <value>#afbfff</value> <value>#91a7ff</value> <value>#738ffe</value> <value>#5677fc</value> <value>#4e6cef</value> <value>#455ede</value> <value>#3b50ce</value> </colors> <legend/> <serieslist> <series joinBy="hc-key" valueField="Id" countryfield="BillingCountry" modelId="Account" statefield="BillingState" aggFunction="count"/> </serieslist> <buckets/> <renderconditions logictype="and"/> </skuidvis__geochart> <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Account" mode="read"> <fields> <field id="Name" allowordering="true"/> <field id="CreatedDate" allowordering="true"/> <field id="BillingCity"/> <field id="BillingCountry"/> <field id="BillingState"/> </fields> <rowactions> <action type="edit"/> <action type="delete"/> </rowactions> <massactions usefirstitemasdefault="true"> <action type="massupdate"/> <action type="massdelete"/> </massactions> <views> <view type="standard"/> </views> </skootable> </components> <resources> <labels/> <css/> <javascript/> </resources> </skuidpage> 



I wanted to know as well. Happy charting!
337f22ef1dfe0118685e7d4c01dfb26cdf9614c5.png


er … uh … that’s not what the issue was.

What Country code do you have? USA doesn’t work. US does.931ffc351b678817645948edc1959156a81ee577.png


Well this is odd - mine are both full text for country/state code (the picklist data type) and for BillingCountry/BillingState fields (string data type).

I do have state & country picklists enabled so that might affect things. I had thought the BillingCountryCode (picklist field) would bring up the 2-letter country code (which is coming up as ‘US’ in my state & country settings).

Still can’t get it to work…

7d17dda0dd01c69813bc912060a6543e00390bcc.jpg



I’m using the 2 char strings for it to work. Seems to only work with 2 char strings. Those code fields. Are they custom fields? I don’t remember seeing them.


ah ha! that would be the reason. I created a custom text formula field on the Account model which just contains “US”, and now its rendering (all accounts based in the US) - so it must be operating on the 2-letter country code.

However, the 2-letter code doesn’t appear to be available to my model - I would think it has something to do with state & country picklists - have you got them enabled or not?

f3a85edfdde372c433c2239f1006b0ef5c3f294d.jpg



I went ahead and enabled State and Country picklists to see if it would work in my org. Does not seem to work.





2 character codes is all that seems to work.


I don’t have anything except a text field where the 2 char code is typed in. Not the most elegant. Hopefully there is something better than this.


Country codes and State/Province codes are two character codes.  This will probably be cleared up once documentation is provided.  


Oh! I haven’t yet used this feature. Looking into it now.


The codes must on another object or something. Looking for it now.


https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_addresssettings.htm


K. Well. That is weird. The value of the code fields are not what is being passed into the geo chart.


I created two text formula that simply converts the code fields to text. The proper 2 char is is the result.


These picklist fields are odd. They display differently than the values stored.



We need documentation 🙂.  This very well may be a backlog item.  If so, your suggestion seems to be a fine interim solution for using country/state/province picklists.  Just gotta luv dem formula fields!


Hi, guys. Thanks for helping us kick the tires a bit on GeoCharts. We’re excited to see how you use it! It looks like you already found the tie in to State and Country Picklists. The maps we deliver are made to play nicely with your data if you use this Salesforce feature, but as you noticed, you did uncover a bug (and a workaround!). I’ve already got it patched up in our Dev Org, and it should go out with our next patch release. We are also continuing to beef up our documentation, so look for updates to that in the near future.

Just to save anyone who may stumble across this thread some time catching up, the country and state values used by the maps we deliver correspond to two character ISO codes. If your org has full country names or some other abbreviations (e.g. “U.S.A.”), you’ll need to convert the data or use formula fields to translate it. Creating one off formula fields is a quick way to get results, but of course, that only works one object at a time, and isn’t the most scalable solution. Salesforce also prevents grouping on Formula Fields in aggregate queries. The aforementioned Salesforce State and Country Picklists feature can help too, but be warned, it is a process that takes time to implement and you can’t go back once you enable it, so be sure to read up on it and try it out in a testing environment first.


Thanks guys. No worries. Good to know I’m not going mad at least.


http://www.highcharts.com/maps/demo/all-maps#custom/world has demos showing the different areanames that can be used. I think these are the sames that Skuid uses.


ISO Codes for Countries, State Postal Codes for States… how about counties?


The county maps all use three digit FIPS codes (http://www.census.gov/geo/reference/codes/cou.html). So for Hamilton County, TN, the country code would be US, the state code would be TN, and the county code would be 065.


Hey all… Just a comment, you might want to add the county code thing to the tutorial document.  I followed that document and my counties didn’t show up, but I found this to be the reason.  Now off to convert my counties to codes…


Thanks Chandra.  I’ll pass this along to our documentation guru. 


Thanks for letting us know!

I’ve updated the documentation to include information on the County FIPS Code when charting county data.

Also, I included a note on the proper ISO code for fictional countries (ZZ). Just in case, you happen to do business with Narnia.