Skip to main content

This issue relates to this thread: https://community.skuid.com/t/ui-only-picklist-options-that-are-values-from-a-field-on-an…


I was able to get John’s recommended code working on the latest version of Skuid for Salesforce, but when I try to implement on Skuid Platform it doesn’t work. I’m thinking there might be a bug with how Skuid Platform is applying the model conditions via javascript. Basically nothing happens when the javascript is run and the conditions should have been applied.


Here is sample code for Skuid Platform (change the datasource) to reproduce the issue:


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true"> <models> <model id="Filter" query="false" createrowifnonefound="false" datasource="ENTER_SALESFORCE_DATASOURCE" processonclient="true" type="" sobject="Account" limit="1" uniqueid="sk-pNJKb-264"> <fields> <field id="Id" accessible="true" createable="false" editable="false" filterable="true" groupable="true" sortable="true" displaytype="ID" label="Account ID"/> <field id="Industry" accessible="true" createable="true" editable="true" filterable="true" groupable="true" sortable="true" length="40" displaytype="PICKLIST" label="Industry"/> </fields> <conditions> <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Industry" state="filterableoff" inactive="true" name="Industry"/> </conditions> <actions> <action> <actions> <action type="blockUI" message="Applying..."/> <action type="custom"> <onerroractions> <action type="blockUI" message="There was an error" timeout="3000"/> </onerroractions> </action> <action type="requeryModel" model="Account" behavior="standard"> <onerroractions> <action type="blockUI" message="There was an error" timeout="3000"/> </onerroractions> </action> <action type="unblockUI"/> </actions> <events> <event>models.loaded</event> </events> </action> </actions> </model> <model id="Account" query="true" createrowifnonefound="false" datasource="Alignly_SFDC_DEV" processonclient="true" type="" sobject="Account" limit="50" uniqueid="sk-pNJKb-264"> <fields> <field id="Id" accessible="true" createable="false" editable="false" filterable="true" groupable="true" sortable="true" displaytype="ID" label="Account ID"/> <field id="Industry" accessible="true" createable="true" editable="true" filterable="true" groupable="true" sortable="true" length="40" displaytype="PICKLIST" label="Industry"/> <field id="Name" accessible="true" createable="true" editable="true" filterable="true" groupable="true" namefield="true" required="true" sortable="true" length="255" displaytype="STRING" label="Account Name"/> </fields> <conditions> <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Industry" state="filterableoff" inactive="true" name="Industry"/> </conditions> <actions/> </model> </models> <components> <filterset searchmethod="server" searchbox="true" uniqueid="sk-pMHJn-162" model="Filter" position="right" emptysearchbehavior="query"> <filters> <filter type="select" filteroffoptionlabel="All Industries" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="manual" filtermethod="server" labelmode="manual" condition="Industry" label="Industry"> <sources> <source type="metadata" effectsbehavior="justdefault"/> </sources> </filter> </filters> <searchfields/> </filterset> <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="50" alwaysresetpagination="false" createrecords="false" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-pMI80-166" model="Account"> <fields> <field id="Name" hideable="true" uniqueid="fi-pNdYe-454" valuehalign="" type=""/> <field id="Industry" hideable="true" uniqueid="fi-pNdy5-466" valuehalign="" type=""/> </fields> <rowactions/> <massactions usefirstitemasdefault="true"/> <views> <view type="standard"/> </views> <renderconditions logictype="and"/> <searchfields/> </skootable> </components> <resources> <labels/> <javascript> <jsitem location="inlinesnippet" name="crossFilter" cachelocation="false" url="">var $ = skuid.$, Filter_Model = skuid.$M('Filter'); Account_Model = skuid.$M('Account'); $.each(Filter_Model.conditions, function(i,condition){ var priConditionName = condition.name, basicCondition1 = Account_Model.getConditionByName(priConditionName); if(condition.inactive) { Account_Model.deactivateCondition(basicCondition1); } else { Account_Model.activateCondition(basicCondition1); Account_Model.setCondition(basicCondition1,condition.value); } });</jsitem> </javascript> <css/> <actionsequences uniqueid="sk-pNJKb-263"/> </resources> <styles> <styleitem type="background" bgtype="none"/> </styles> </skuidpage>

Based on what I can see, the “crossFilter” Snippet is not being invoked by anything in your Skuid Page. When are you trying to have this Snippet invoked? As a result of a Model Action / button click? If so, you will need to configure the Model Action / Button to invoke the Snippet using the “Run Snippet” action type.


Zach - I appreciate the reply and sorry for the delay in the follow-up. In my haste building out a sample page, I included the “Run Snippet” but forgot to select the actual snippet. Here’s the sample code where I’m still having the issue. The actions are on the “Filter” model and are run when the model is requeried (filter is applied).



<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true"> <models> <model id="Filter" query="false" createrowifnonefound="false" datasource="ENTER_SALESFORCE_DATASOURCE" processonclient="true" type="" sobject="Account" limit="1" uniqueid="sk-pNJKb-264"> <fields> <field id="Id" accessible="true" createable="false" editable="false" filterable="true" groupable="true" sortable="true" displaytype="ID" label="Account ID"></field> <field id="Industry" accessible="true" createable="true" editable="true" filterable="true" groupable="true" sortable="true" length="40" displaytype="PICKLIST" label="Industry"></field> </fields> <conditions> <condition type="multiple" value="" field="Industry" state="filterableoff" inactive="true" name="Industry" operator="in" enclosevalueinquotes="true"> <values> <value></value> </values> </condition> <condition type="multiple" field="Industry" operator="in" inactive="true" enclosevalueinquotes="true" name=" __autofilter__ Industry" state="filterableoff" value=""></condition> </conditions> <actions> <action> <actions> <action type="blockUI" message="Applying..."></action> <action type="custom" snippet="crossFilter"> <onerroractions> <action type="blockUI" message="There was an error" timeout="3000"></action> </onerroractions> </action> <action type="requeryModel" model="Account" behavior="standard"> <onerroractions> <action type="blockUI" message="There was an error" timeout="3000"></action> </onerroractions> </action> <action type="unblockUI"></action> </actions> <events> <event>models.loaded</event> </events> </action> </actions> </model> <model id="Account" query="true" createrowifnonefound="false" datasource="Alignly_SFDC_DEV" processonclient="true" type="" sobject="Account" limit="50" uniqueid="sk-pNJKb-264"> <fields> <field id="Id" accessible="true" createable="false" editable="false" filterable="true" groupable="true" sortable="true" displaytype="ID" label="Account ID"></field> <field id="Industry" accessible="true" createable="true" editable="true" filterable="true" groupable="true" sortable="true" length="40" displaytype="PICKLIST" label="Industry"></field> <field id="Name" accessible="true" createable="true" editable="true" filterable="true" groupable="true" namefield="true" required="true" sortable="true" length="255" displaytype="STRING" label="Account Name"></field> </fields> <conditions> <condition type="multiple" value="" field="Industry" state="filterableoff" inactive="true" name="Industry" operator="in" enclosevalueinquotes="true"> <values> <value></value> </values> </condition> </conditions> <actions></actions> </model> </models> <components> <filterset searchmethod="server" searchbox="true" uniqueid="sk-pMHJn-162" model="Filter" position="right" emptysearchbehavior="query"> <filters> <filter type="multiselect" filteroffoptionlabel="All Industries" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="auto" filtermethod="server" labelmode="manual" condition="Industry" label="Industry" conditionfield="Industry" conditionoperator="in"></filter> </filters> <searchfields></searchfields> </filterset> <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="50" alwaysresetpagination="false" createrecords="false" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-pMI80-166" model="Account"> <fields> <field id="Name" hideable="true" uniqueid="fi-pNdYe-454" valuehalign="" type=""></field> <field id="Industry" hideable="true" uniqueid="fi-pNdy5-466" valuehalign="" type=""></field> </fields> <rowactions></rowactions> <massactions usefirstitemasdefault="true"></massactions> <views> <view type="standard"></view> </views> <renderconditions logictype="and"></renderconditions> <searchfields></searchfields> </skootable> </components> <resources> <labels></labels> <javascript> <jsitem location="inlinesnippet" name="crossFilter" cachelocation="false" url="">var $ = skuid.$, Filter_Model = skuid.$M('Filter'); Account_Model = skuid.$M('Account'); $.each(Filter_Model.conditions, function(i,condition){ var priConditionName = condition.name, basicCondition1 = Account_Model.getConditionByName(priConditionName); if(condition.inactive) { Account_Model.deactivateCondition(basicCondition1); } else { Account_Model.activateCondition(basicCondition1); Account_Model.setCondition(basicCondition1,condition.value); } });</jsitem> </javascript> <css></css> <actionsequences uniqueid="sk-pNJKb-263"></actionsequences> </resources> <styles> <styleitem type="background" bgtype="none"></styleitem> </styles> </skuidpage>

Reply