Problem with State/Province Code showing the wrong 'state' in a template field

We are using Salesforce’s State and Country picklists. When we display the State/Province Code in a separate column on a table component, the field shows the appropriate ‘state’ based on the selected country code and state/province code on the record. When we display the State/Province Code in a template field, it pulls in the wrong ‘state’ for the selected country code and state/province code on the record.

In this example, you can see that we have set the state and country to be Pennsylvania and United States.

Viewing the same record in a template field, shows:

Note that ‘Palermo’ is a province in Italy. It’s State/Province Code is ‘PA’ and matches Pennsylvania’s code.

There are two sets of fields - for State and Country, there is a picklist field titled code and a text field.

In my testing, if you change the countryCode field to Italy, the Normal State field will not update automatically while the State Code field will be updated to Palermo.

So, make sure you are showing the same set of fields. Either the code or the normal ones. But not a mix…


Thanks for your reply. I was able to isolate what the issue seems to be. It’s not a problem with the template field. It seems to be with using the Parent relationship to traverse the object data and pull in the State Code field from the Parent object. In my first screenshot I was building a list view based on a junction object. I was using the Parent relationship to pull in the State Code field.

I have created a list view based on the Contact object. As you can see I can pull in the State Code field for the Contact object without issue. When I use the Parent relationship to the Account object and pull in the State Code field, I get the results that I reported where the Shipping State Code on the parent Account to the Contact object shows as a ‘state/province’ for another country.

I have attached the xml for my page so you can install it in your org. Let me know if you need more details.



<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Contact">
{{Model.labelPlural}} Home Account Template Field {{Account.ShippingStateCode}} {{Account.ShippingCountryCode}} Contact Template Field {{MailingStreet}}, {{MailingCity}}, {{MailingStateCode}} {{Mailing_Zip_Code_Lookup__ r.Name}} {{MailingCountryCode}}

Thanks for the XML.  In the org where we have state / country picklist values implemented I get the results I would expect and its hard to get a record to save with a bad state code.    Would you mind showing me what the account detail page for Kennedy Health Alliance looks like?  (with both the regular values and the state values)   I’m still not convinced there isn’t a mismatch in that record. 

Rob…I created simple pages for the Account record–both a list view and detail view. They show the Account record with the correct data. Here are the screenshots:

I also did an SOQL query using Workbench. It shows the right StateCode and CountryCode for Kennedy Health Alliance.

Rob…I was able to reproduce the problem I am seeing in a Developer Org. where I just installed Skuid and just enabled the State and Country picklists.  I used the same page that I sent to you in an earlier thread. In this screenshot, the State Province code should show as California.

Tomorrow I’ll spin up a new Dev Org.  The org I was in was a little old…  We’ll keep trying to figure this out. 

Rob…any update on this issue?


We still have a problem with the State/Province code not showing the right value in Template fields.  We were able to work around this issue with some of our users. We now have a situation where we can’t use the work around.

Would you you look into this.



Hi Bill~

I believe the problem is actually stemming from how Salesforce handles the data. When you use the state/country picklist, the states are dependent on the country. When you change the country, your options for the states also change. Unfortunately, when there is a state in the new country that has the same state code, it will automatically change to that state. See my example below.

Here is the correct state info based on a country selection of the U.S.

However, when I change the country to Italy, notice that 2 things happen.

  • The billing state gets overriden to None because there isn’t a state in Italy that has TX as its state code.
  • The shipping state changed to Palermo because Palermo has the same state code as Pennsylvania.

This faulty data, then, gets passed into your Skuid page as well. We will open up a case with Salesforce about this issue and let you know what we find out.

Hope this clarifies the problem.



Thanks for looking into this. This does seem to be strange behavior in Salesforce.

I am not sure that this is the cause of the issue I see in Skuid. Here is a Skuid page from my developer org. that shows what I am seeing.

I have a list of Contact records and I am showing fields from the ‘parent’ Account record. I also added a drawer to show the data from the Account. You can see that the state and country are correctly set. The data in the table incorrectly shows the state as ‘Cagliari’ instead of ‘California’. This seems more like a display issue for Skuid.



State Code from Account

Country Code from Account

Account Address Template Field
{{Account.ShippingStateCode}} {{Account.ShippingCountryCode}}

Contact State Code

Contact Cournry Code

Contact Address Template Field
{{MailingStreet}}, {{MailingCity}}, {{MailingStateCode}} {{Mailing_Zip_Code_Lookup__r.Name}} {{MailingCountryCode}}

Thanks Buddy ,


As a workardound, we added a Salesforce formula field to display the value from the StateCode field.  We use this in reference fields or template fields to display the correct 2 letter code instead of the rendered ‘State Name’ that shows the wrong state.

I think using a triple mustache should work to display the 2 letter code instead of the rendered name (e.g. {{{MailingStateCode}}}).



Hi Bill ,

This is very easy to show state name according to Country Name  .We have used filed editor component in Skuid page ,

After is working fine , U can also use table .



Any feedback on this?  Same problem here, looking up country code on parent account and getting the wrong interpretation, is correct in the db…


I still see the problem in 10.0.4.  If you show the CountryCode field from the parent account as a template field and use a triple mustache, you will get the 2 letter code for the country (i.e. {{{ShippingCountryCode}}}).  If you need the country name, I’d suggest a Salesforce formula field.


Any update on this?  Is it in the queue for a fix?



I just recently started experiencing this issue. Any news on this?