Problem in selecting the multiselect picklist values from javascript snippet based on the another fi

I had a requirement to update the Mutlipicklist value based on other picklist value. scenario :condition (1) If picklist1 = x value selected then it should update the Multiselectpicklist value with x,y as default and user should be able to select other values ex : z also along with x,y. condition ( 2) : user should be able to deselect the default values if they are not intrested.)

Hi Sudeer,

If you’re in a new-enough version of Skuid, you can use a model action with the Branch feature to get this working.

In my test page, I have a model on the Account object. It has a model action set to run some actions whenever the Industry field is updated. That looks like this:

The actions it runs look like this:

(Edited to include this screenshot of the action itself):

It will evaluate the value of Industry and run a different set of actions, depending on what the value is. I’d recommend reading our documentation on the Action Framework, specifically for the Branch action, to help you understand this.

Below is the XML for my test page. It uses a custom field, “TestMulti__c” on the Account object, so you might need to replace the field name or model if you want to use the code. Or, you may be able to set your solution up by following the screenshots above.

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true"> <models> <model id="acc" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" type="" sobject="Account"> <fields> <field id="Industry"></field> <field id="Name"></field> <field id="TestMulti __c"></field> </fields> <conditions></conditions> <actions> <action> <actions> <action type="branch" model="acc" label="Industry is Consulting"> <formula>{{Industry}} == "Consulting"</formula> <iftrueactions> <action type="updateRow" fieldmodel="acc" affectedrows="context" field="TestMulti__ c" enclosevalueinquotes="true" value="A;B"></action> </iftrueactions> </action> <action type="branch" label="Industry is Government" model="acc"> <formula>{{Industry}} == "Government"</formula> <iftrueactions> <action type="updateRow" fieldmodel="acc" affectedrows="context" field="TestMulti __c" enclosevalueinquotes="true" value="C;D"></action> </iftrueactions> </action> </actions> <events> <event>row.updated</event> </events> <fields> <field>Industry</field> </fields> </action> </actions> </model> </models> <components> <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="acc" buttonposition="" uniqueid="sk-1YAtfi-125" mode="edit" layout=""> <columns> <column width="50%"> <sections> <section title="Section A" collapsible="no"> <fields> <field id="Name" valuehalign="" type=""></field> <field id="Industry" valuehalign="" type=""></field> </fields> </section> </sections> </column> <column width="50%"> <sections> <section title="Section B" collapsible="no"> <fields> <field id="TestMulti__ c" selectedlist="3" valuehalign="" type="CHECKBOXES"></field> </fields> </section> </sections> </column> </columns> </basicfieldeditor> </components> <resources> <labels></labels> <javascript></javascript> <css></css> </resources> <styles> <styleitem type="background" bgtype="none"></styleitem> </styles> </skuidpage>