spark v2 country and state picklists not working

  • 1
  • Question
  • Updated 4 months ago
  • In Progress
I'm currently building a CPQ solution on Spark v2 for a client who is planning to implement soon, and I'm experiencing issues with the country and state picklists...specifically on Contact Object with the MailingCountryCode and MailingStateCode fields.

When a Country is selected/changed, the dependent states do not render.

This is a bit of an immediate problem, because users won't be able to update Mailing Address info until this is resolved.

Any ideas on a workaround until a fix can be released?
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 4,266 Points 4k badge 2x thumb

Posted 4 months ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 13,280 Points 10k badge 2x thumb
Conlan,

I have Spark v2 (12.0.4) loaded in my developer org.  I just added the MailingStateCode and MailingCountryCode field to a Contact detail page and it appears to be working.

Can you share your page XML?  I want to see if it works in my org.

Thanks,

Bill
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 4,266 Points 4k badge 2x thumb
<skuid__page unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" theme="Ink">
<models>
<model id="Contact" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Contact">
<fields>
<field id="Name"/>
<field id="MailingState"/>
<field id="MailingStateCode"/>
<field id="MailingCountryCode"/>
<field id="MailingCountry"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<skuid__form showErrorsInline="true" model="Contact" uniqueid="sk-1zh-79" mode="edit" showSaveCancel="true">
<sections>
<section title="Contact Info">
<rows>
<row uniqueid="sk-1zl-89">
<fields>
<skuid__field uniqueid="sk-1zl-84" id="Name"/>
</fields>
</row>
<row uniqueid="sk-1zl-92">
<fields>
<skuid__field uniqueid="sk-1zl-85" id="MailingStateCode"/>
</fields>
</row>
<row uniqueid="sk-1zl-95">
<fields>
<skuid__field uniqueid="sk-1zl-86" id="MailingCountryCode"/>
</fields>
</row>
</rows>
</section>
</sections>
<styles>
<spacing top="6" bottom="6" left="6" right="6"/>
</styles>
</skuid__form>
</components>
<resources>
<labels/>
<javascript/>
<css/>
<actionsequences uniqueid="sk-1zZ-72"/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuid__page>

Photo of Conlan O'Rourke

Conlan O'Rourke

  • 4,266 Points 4k badge 2x thumb
Thanks Bill, see XML above. Also see screencast of the issue I am experiencing here: http://recordit.co/wxZaKXERWF
Photo of Bill McCullough

Bill McCullough, Champion

  • 13,280 Points 10k badge 2x thumb
Conlan,

I was able to replicate what you saw using your page XML.

I then tried recreating the page from scratch just to make sure that the XML was good.  I found that if the form is set to Read with Inline Edit, the State Code changes as you change the Country Code.  When the form starts in 'Edit' mode as you have in you sample page; however, the State Code never changes (what you reported).

This is definitely a bug for the Skuid team to fix.

Thanks,

Bill
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 4,266 Points 4k badge 2x thumb
Bill,

Thanks for identifying this. I was able to use this information to create a workaround using an action sequence on the model that "refreshes" the State Code picklist.

It's still less than ideal, because I can't make the State Code field required, and the form disappears and re-appears when the Country Code is updated.

Nonethless, I'm attaching the XML of my workaround in case anyone else needs this until Skuid releases a patch.

<skuid__page unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" theme="Ink">
	<models>
<model id="Contact" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Contact">
	<fields>
		<field id="Name"/>
		<field id="MailingState"/>
		<field id="MailingStateCode"/>
		<field id="MailingCountryCode"/>
		<field id="MailingCountry"/>
	</fields>
	<conditions/>
	<actions>
		<action>
			<actions>
				<action type="showToast" duration="0" styleSettingsVariant="default" message="Refreshing..."/>
				<action type="updateRow" fieldmodel="Contact" affectedrows="context">
					<updates>
						<update valuesource="blank" field="MailingStateCode" enclosevalueinquotes="true"/>
					</updates>
				</action>
				<action type="save">
					<models>
						<model>Contact</model>
					</models>
					<onerroractions>
						<action type="blockUI" message="There was an error" timeout="3000"/>
					</onerroractions>
				</action>
				<action type="abandonRows" model="Contact" affectedrows="context"/>
				<action type="requeryModel" model="Contact" behavior="standard"/>
				<action type="runComponentAction" componentid="sk-1zh-79" action="changeMode" mode="edit"/>
				<action type="showToast" duration="2" styleSettingsVariant="default" message="Done!"/>
			</actions>
			<events>
				<event>row.updated</event>
			</events>
			<fields>
				<field>MailingCountryCode</field>
			</fields>
		</action>
	</actions>
</model>
</models>
	<components>
<skuid__buttonSet model="Contact" uniqueid="sk-6u_-282" expandToFill="false">
	<groups>
		<skuid__buttonGroup>
			<buttons>
				<skuid__button label="Refresh" uniqueid="sk-75N-472" icon="sk-webicon-font-awesome:repeat" styleSettingsVariant="primary">
					<actions>
						<action type="emptyModelData">
							<models>
								<model>Contact</model>
							</models>
						</action>
						<action type="requeryModel" model="Contact" behavior="standard"/>
					</actions>
				</skuid__button>
				<skuid__button label="Update Contact" uniqueid="sk-6u_-286">
					<actions>
						<action type="redirect" window="blank" url="/{{Id}}"/>
					</actions>
				</skuid__button>
			</buttons>
		</skuid__buttonGroup>
		<skuid__buttonGroup>
			<buttons>
				<skuid__button label="Switch Edit/Read-Only" uniqueid="sk-73W-390" icon="sk-webicon-font-awesome:random" styleSettingsVariant="circular">
					<actions>
						<action type="runComponentAction" componentid="sk-1zh-79" action="changeMode"/>
					</actions>
					<tooltip position="bottom" text="Switch Edit/Read-Only"/>
				</skuid__button>
				<skuid__button label="Save" uniqueid="sk-73q-402" icon="sk-webicon-font-awesome:check" styleSettingsVariant="circularWithBorder">
					<actions>
						<action type="save">
							<models>
								<model>Contact</model>
							</models>
							<onerroractions>
								<action type="blockUI" message="There was an error" timeout="3000"/>
							</onerroractions>
						</action>
					</actions>
					<tooltip position="bottom" text="Save"/>
				</skuid__button>
			</buttons>
		</skuid__buttonGroup>
	</groups>
	<styles>
		<spacing top="5" bottom="5" right="6"/>
	</styles>
	<renderConditions logictype="and"/>
</skuid__buttonSet>
<skuid__form showErrorsInline="true" model="Contact" uniqueid="sk-1zh-79" mode="read" showSaveCancel="false">
	<sections>
		<section title="Contact Info">
			<rows>
				<row uniqueid="sk-1zl-89">
					<fields>
						<skuid__field uniqueid="sk-1zl-84" id="Name"/>
					</fields>
				</row>
				<row uniqueid="sk-1zl-92">
					<fields>
						<skuid__field uniqueid="sk-1zl-85" id="MailingStateCode" required="false" addNoneOption="true" noneLabel="--Select--">
							<renderConditions logictype="and" onhidedatabehavior="keep"/>
							<enableConditions/>
						</skuid__field>
						<skuid__field uniqueid="sk-1zl-86" id="MailingCountryCode" required="true" addNoneOption="true" noneLabel="--Select--"/>
					</fields>
				</row>
			</rows>
		</section>
	</sections>
	<styles>
		<spacing top="6" bottom="6" left="6" right="6"/>
	</styles>
	<renderConditions logictype="and">
		<renderCondition type="fieldvalue" operator="gte" enclosevalueinquotes="true" fieldmodel="Contact" sourcetype="viewport" nosourcerowbehavior="deactivate" value="500px"/>
	</renderConditions>
</skuid__form>
</components>
	<resources>
		<labels/>
		<javascript/>
		<css/>
		<actionsequences uniqueid="sk-1zZ-72">
<actionsequence id="06250261-6f71-4506-8440-25e97cc9536c" label="New Sequence" type="reusable">
	<description/>
	<actions/>
</actionsequence>
</actionsequences>
	</resources>
	<styles>
		<styleitem type="background" bgtype="none"/>
	</styles>
</skuid__page>
Photo of Bill McCullough

Bill McCullough, Champion

  • 13,280 Points 10k badge 2x thumb
Conlan,

Thanks for sharing your workaround.  Nice use of the action framework.

Best,

Bill