How to Bind Skuid Picklist Ui field from snippet

  • 1
  • Question
  • Updated 8 months ago
  • Answered
Hi,

I have created apex class which returns list object( consist of Id and Name ).
I wanted to bind these data to my Skuid UI Picklist field



Thanks in Advance
Joyson
Photo of Joyson   Tuscano

Joyson Tuscano

  • 144 Points 100 badge 2x thumb

Posted 8 months ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Joyson,

You may not need your Apex class.  You can bind a UI Picklist field to a model.  Here is a sample built on a Task model with a second model to lookup Contacts whose Mailing State is Maryland.  Make sure you change the condition on the ContactLookup model to return some rows from your data.

Thanks,

Bill


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="ContactLookup" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Contact">
            <fields>
                <field id="Id"/>
                <field id="Name"/>
                <field id="MailingState"/>
            </fields>
            <conditions>
                <condition type="fieldvalue" value="Maryland" enclosevalueinquotes="true" field="MailingState"/>
            </conditions>
            <actions/>
        </model>
        <model id="Task" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" sobject="Task">
            <fields>
                <field id="WhoId"/>
                <field id="Who.Name"/>
                <field id="ContactLookup" uionly="true" displaytype="PICKLIST" label="ContactLookup" ogdisplaytype="TEXT" datasource="salesforce" picklistsource="rowsinmodel" picklistmodel="ContactLookup"/>
            </fields>
            <conditions/>
            <actions>
                <action>
                    <actions>
                        <action type="updateRow" fieldmodel="Task" affectedrows="context" field="WhoId" fieldtargetobjects="Contact,Lead" enclosevalueinquotes="true" value="{{ContactLookup}}"/>
                    </actions>
                    <events>
                        <event>row.updated</event>
                    </events>
                    <fields>
                        <field>ContactLookup</field>
                    </fields>
                </action>
            </actions>
        </model>
    </models>
    <components>
        <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Task" uniqueid="sk-14M--371" mode="edit">
            <columns>
                <column width="50%">
                    <sections>
                        <section title="Section A" collapsible="no">
                            <fields>
                                <field uniqueid="sk-14M--749" id="ContactLookup"/>
                            </fields>
                        </section>
                    </sections>
                </column>
                <column width="50%">
                    <sections>
                        <section title="Section B">
                            <fields>
                                <field uniqueid="sk-14M--473" id="WhoId"/>
                            </fields>
                        </section>
                    </sections>
                </column>
            </columns>
        </basicfieldeditor>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-14M--254"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>