Locking a model from further update

  • 1
  • Question
  • Updated 2 weeks ago
  • In Progress
I am new to Skuid and here is the use case that i am trying to build:

Use a filter to get a list of accounts.  Update the list to remove accounts.  Once the list is complete, lock it so that no further accounts can be updated.  
Email this list to the users. 



Photo of Jaiti

Jaiti

  • 202 Points 100 badge 2x thumb

Posted 3 weeks ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,758 Points 10k badge 2x thumb
jaiti,

Here's a demonstration page that handles getting a list of accounts and sending an email with the account data.  When you say '...so that no further accounts can be updated'...is this only on this page?  Or are you trying to prevent anyone from editing the accounts anywhere in  Salesforce?

Thanks,

Bill

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" useviewportmeta="true" showheader="false">
    <models>
        <model id="Accounts" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Account" limit="100">
            <fields>
                <field id="Id"/>
                <field id="Name"/>
            <field id="Phone"/>
<field id="Type"/>
</fields>
            <conditions>
<condition type="fieldvalue" field="Type" operator="=" inactive="true" enclosevalueinquotes="true" name="__autofilter__Type" state="filterableoff" value=""/>
</conditions>
            <actions/>
        </model>
        <model id="UIOnly" limit="20" query="true" createrowifnonefound="true" datasource="Ui-Only" processonclient="true">
<fields>
    <field id="FromModel" displaytype="TEXT" label="FromModel" length="5000" defaultvaluetype="fieldvalue"/>
    <field id="To" displaytype="TEXT" label="To"/>
    <field id="From" displaytype="TEXT" label="From"/>
    <field id="Body" displaytype="TEXTAREA" label="Body" length="5000" ogdisplaytype="TEXT"/>
    <field id="Subject" displaytype="TEXT" label="Subject"/>
</fields>
<conditions/>
<actions/>
</model>
    </models>
    <components>
        <grid uniqueid="sk-1RBR-1706" columngutter="4px">
            <divisions>
                <division behavior="specified" verticalalign="top" width="50vw">
                    <components>
<buttonset model="Accounts" uniqueid="sk-1VFk-554" position="left">
    <buttons>
        <button type="multi" label="Set Email Data" uniqueid="sk-1VGJ-939" icon="sk-icon-magic">
            <actions>
                <action type="runComponentAction" componentid="sk-1R8C-408" action="changeMode" mode="read"/>
                <action type="updateRow" fieldmodel="UIOnly" affectedrows="context" field="Body" enclosevalueinquotes="true" value="{{#$Model.Accounts.data}}{{Name}}, {{Phone}} ---{{/$Model.Accounts.data}}"/>
                <action type="updateRow" fieldmodel="UIOnly" affectedrows="context" field="From" enclosevalueinquotes="true" value="{{$User.email}}"/>
                <action type="updateRow" fieldmodel="UIOnly" affectedrows="context" field="Subject" enclosevalueinquotes="true" value="List of Accounts"/>
                <action type="updateRow" fieldmodel="UIOnly" affectedrows="context" field="To" enclosevalueinquotes="true" value="{{$User.email}}"/>
            </actions>
        </button>
    </buttons>
</buttonset>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="5" alwaysresetpagination="false" createrecords="true" model="Accounts" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-1R8C-408" heading="Accounts">
                            <fields>
                                
                                <field id="Name" uniqueid="fi-1R8C-410"/>
                            <field id="Phone" hideable="true" uniqueid="fi-1vNF-429"/>
<field id="Type" hideable="true" uniqueid="fi-1vQ0-1358"/>
</fields>
                            <rowactions>
                                <action type="edit"/>
                                <action type="delete"/>
                            </rowactions>
                            <massactions usefirstitemasdefault="true">
                                <action type="multi" label="Concat" icon="sk-icon-magic">
                                    <actions>
                                        <action type="custom" snippet="newSnippet"/>
                                        <action type="adoptRows" sourcemodel="Accounts" targetmodel="Accounts_Adopt" affectedrows="context"/>
                                        <action type="updateRow" fieldmodel="Accounts_Adopt" affectedrows="all" field="currval" enclosevalueinquotes="false" value="1"/>
                                    </actions>
                                </action>
                            </massactions>
                            <views>
                                <view type="standard"/>
                            </views>
                            <actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true"/>
                        <searchfields/>
<filters>
    <filter type="select" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="auto" labelmode="auto" filtermethod="server" conditionfield="Type" filteroffoptionlabel="Any Type"/>
</filters>
</skootable>
                        
                    </components>
                </division>
                <division behavior="flex" verticalalign="top" minwidth="100px" ratio="1">
                    <components>
<buttonset model="Accounts" uniqueid="sk-1vNr-573" position="left">
    <buttons>
        <button type="multi" label="Send Email" uniqueid="sk-1vNz-646" icon="sk-icon-send-email">
            <actions>
                <action type="datasource-action" datasource="salesforce" actionname="emailSimple">
                    <inputs>
                        <input name="emailAddresses" displaytype="string" value="{{$Model.UIOnly.data.0.To}}"/>
                        <input name="senderAddress" displaytype="string" value="{{$Model.UIOnly.data.0.From}}"/>
                        <input name="emailSubject" displaytype="string" value="{{$Model.UIOnly.data.0.Subject}}"/>
                        <input name="emailBody" displaytype="textarea" value="{{$Model.UIOnly.data.0.Body}}"/>
                    </inputs>
                </action>
            </actions>
            <renderconditions logictype="and"/>
            <enableconditions logictype="and">
                <condition type="blank" operator="!=" fieldmodel="UIOnly" sourcetype="fieldvalue" nosourcerowbehavior="deactivate" field="To" value="null" enclosevalueinquotes="false"/>
            </enableconditions>
        </button>
    </buttons>
</buttonset>
<basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="UIOnly" uniqueid="sk-1vNm-544" mode="edit" buttonposition="left">
    <columns>
        <column width="100%" uniqueid="sk-1vNm-540">
            <sections>
                <section title="Email" uniqueid="sk-1vNm-541" collapsible="no">
                    <fields>
                        <field uniqueid="sk-1vNx-611" id="To"/>
                        <field uniqueid="sk-1vNx-612" id="From"/>
                        <field uniqueid="sk-1vNx-613" id="Subject"/>
                        <field uniqueid="sk-1vNx-614" id="Body"/>
                    </fields>
                </section>
            </sections>
        </column>
    </columns>
</basicfieldeditor>
                    </components>
                </division>
            </divisions>
            <styles>
                <styleitem type="background" bgtype="none"/>
            </styles>
        </grid>
    </components>
    <resources>
        <labels/>
        <javascript>
        </javascript>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>

Photo of Jaiti

Jaiti

  • 202 Points 100 badge 2x thumb
No addition/ removal from the
model

Photo of Bill McCullough

Bill McCullough, Champion

  • 12,758 Points 10k badge 2x thumb
jaiti,

I would disable the Save button using the 'Enable' conditions on the Rendering tab for the button.

Thanks,

Bill