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.
Bill McCullough, Champion
-
13,602 Points
Posted 5 years ago
Rob Hatch, Official Rep
-
44,968 Points

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...
Bill McCullough, Champion
-
13,602 Points
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.
Thanks,
Bill
<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Contact">
<models>
<model id="Contact" limit="100" query="true" createrowifnonefound="false" sobject="Contact">
<fields>
<field id="FirstName"/>
<field id="LastName"/>
<field id="CreatedDate"/>
<field id="MailingCity"/>
<field id="MailingCountryCode"/>
<field id="MailingStateCode"/>
<field id="MailingStreet"/>
<field id="AccountId"/>
<field id="Account.Name"/>
<field id="Mailing_Zip_Code_Lookup__r.Name"/>
<field id="Account.ShippingCountryCode"/>
<field id="Account.ShippingStateCode"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<pagetitle model="Contact">
<maintitle>
<template>{{Model.labelPlural}}</template>
</maintitle>
<subtitle>
<template>Home</template>
</subtitle>
<actions>
<action type="savecancel"/>
</actions>
</pagetitle>
<skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Contact" mode="read">
<fields>
<field id="FirstName" allowordering="true"/>
<field id="LastName" allowordering="true"/>
<field id="AccountId"/>
<field id="Account.ShippingStateCode"/>
<field id="Account.ShippingCountryCode"/>
<field type="COMBO" valuehalign="">
<label>Account Template Field</label>
<template>{{Account.ShippingStateCode}} {{Account.ShippingCountryCode}}</template>
</field>
<field id="MailingStateCode" valuehalign="" type=""/>
<field id="MailingCountryCode"/>
<field type="COMBO" valuehalign="">
<label>Contact Template Field</label>
<template>{{MailingStreet}}, {{MailingCity}}, {{MailingStateCode}} {{Mailing_Zip_Code_Lookup__r.Name}} {{MailingCountryCode}}</template>
</field>
</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>
Rob Hatch, Official Rep
-
44,968 Points
Bill McCullough, Champion
-
13,602 Points


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

Bill McCullough, Champion
-
13,602 Points

Rob Hatch, Official Rep
-
44,968 Points
Bill McCullough, Champion
-
13,602 Points
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.
Thanks,
Bill
Karen Waldschmitt, Official Rep
-
9,082 Points
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!
Karen
Bill McCullough, Champion
-
13,602 Points
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.

<skuidpage unsavedchangeswarning="yes" showsidebar="false" showheader="true" tabtooverride="Contact" personalizationmode="server"> <models>
<model id="Contact" limit="100" query="true" createrowifnonefound="false" sobject="Contact" adapter="salesforce" service="salesforce" type="">
<fields>
<field id="FirstName"/>
<field id="LastName"/>
<field id="CreatedDate"/>
<field id="MailingCity"/>
<field id="MailingCountryCode"/>
<field id="MailingStateCode"/>
<field id="MailingStreet"/>
<field id="AccountId"/>
<field id="Account.Name"/>
<field id="Account.ShippingCountryCode"/>
<field id="Account.ShippingStateCode"/>
<field id="Account.Id"/>
</fields>
<conditions/>
<actions/>
</model>
<model id="AccountDrawer" limit="20" query="false" createrowifnonefound="false" adapter="salesforce" service="salesforce" type="" sobject="Account">
<fields>
<field id="Name"/>
<field id="Id"/>
<field id="ShippingCountry"/>
<field id="ShippingCountryCode"/>
<field id="ShippingState"/>
<field id="ShippingStateCode"/>
<field id="ShippingStreet"/>
<field id="ShippingPostalCode"/>
<field id="ShippingCity"/>
</fields>
<conditions>
<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" state="filterableoff" inactive="true" name="AccountIdDrawer"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Contact" uniqueid="sk-2qqdCo-87">
<maintitle>
<template>{{Model.labelPlural}}</template>
</maintitle>
<subtitle>
<template>Home</template>
</subtitle>
<actions>
<action type="savecancel"/>
</actions>
</pagetitle>
<skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Contact" mode="read" uniqueid="sk-2qqdCo-88">
<fields>
<field id="FirstName" allowordering="true"/>
<field id="LastName" allowordering="true"/>
<field id="AccountId"/>
<field id="Account.ShippingStateCode" valuehalign="" type="">
<label>State Code from Account</label>
</field>
<field id="Account.ShippingCountryCode" valuehalign="" type="">
<label>Country Code from Account</label>
</field>
<field type="COMBO" valuehalign="">
<label>Account Address Template Field</label>
<template>{{Account.ShippingStateCode}} {{Account.ShippingCountryCode}}</template>
</field>
<field id="MailingStateCode" valuehalign="" type="">
<label>Contact State Code</label>
</field>
<field id="MailingCountryCode" valuehalign="" type="">
<label>Contact Cournry Code</label>
</field>
<field type="COMBO" valuehalign="">
<label>Contact Address Template Field</label>
<template>{{MailingStreet}}, {{MailingCity}}, {{MailingStateCode}} {{Mailing_Zip_Code_Lookup__r.Name}} {{MailingCountryCode}}</template>
</field>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
<action type="drawer" label="Run multiple actions" icon="sk-icon-account-profile" openicon="fa-long-arrow-up">
<drawer title="Drawer Area" width="90%" closehandle="true">
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="AccountDrawer" buttonposition="" uniqueid="sk-2qxxd6-204" mode="read">
<columns>
<column width="50%">
<sections>
<section title="Section A" collapsible="no">
<fields>
<field id="Name" valuehalign="" type=""/>
<field id="ShippingCity"/>
<field id="ShippingCountry"/>
<field id="ShippingCountryCode"/>
<field id="ShippingState"/>
<field id="ShippingStateCode"/>
<field id="ShippingStreet"/>
<field id="ShippingPostalCode"/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="Section B" collapsible="no">
<fields/>
</section>
</sections>
</column>
</columns>
<conditions/>
</basicfieldeditor>
</components>
<beforeload>
<action type="setCondition" model="AccountDrawer" condition="AccountIdDrawer" value="{{AccountId}}"/>
<action type="requeryModel" model="AccountDrawer" behavior="loadmore"/>
</beforeload>
</drawer>
</action>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
-
864 Points
Bill McCullough, Champion
-
13,602 Points
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.
Skuid,
Any update on this? Is it in the queue for a fix?
Thanks,
Bill
-
1,906 Points
Rajesh Kumar
Bill McCullough, Champion
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}}}).
Thanks,
Bill
Rajesh Kumar
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 .
Thanks,
Rajesh