Skip to main content

For my proof of concept to our VP team, I’m trying to create opportunities in mass from a list of accounts. Ideally the user will navigate to their standard opportunities list page (overridden by a skuid page), then apply Skuid filters to the list to select all of the accounts in a specific state. Once the accounts are selected the user would select a mass action button to create a new opportunity record for each of the accounts selected. These records would be visible on a pop-up where the user could fill in a bit more information and save. The problem I’m having is, I haven’t been able to pull the account id over from the account table to the opportunity table. It only pulls the first account id over and uses it for all of the records instead of 1 per 1… We need it to programmatically associate account 1 with oppt 1 and account 2 with oppt 2 etc. Any suggestions?

This could be done using action framework I think.  Give me 5 minutes. I’ll try doing this in a new page for you. Good challenge.


Go Pat Go!!


Woohoo!!! One sec. Double checking.


Here you go. Gould be done using javascript with one less model, but this works well too. It’s kind of like looping through each row to make use of it in context.


Makes use of action framework on each row in context in the “Selected Accounts” model.


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="Account"> <models> <model id="Account" limit="100" query="true" createrowifnonefound="false" sobject="Account" adapter="" type=""> <fields> <field id="Name"/> <field id="CreatedDate"/> <field id="Id"/> </fields> <conditions/> <actions/> </model> <model id="SelectedAccounts" limit="" query="false" createrowifnonefound="false" adapter="" type="" sobject="Account"> <fields> <field id="Id"/> <field id="Name"/> </fields> <conditions> <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" state="filterableoff" inactive="true" name="Id"/> </conditions> <actions> <action> <actions> <action type="createRow" model="NewOpps" appendorprepend="append" defaultmodefornewitems="edit"> <defaults> <default type="fieldvalue" field="AccountId" enclosevalueinquotes="true" value="{{Id}}"/> </defaults> </action> </actions> <events> <event>row.deleted</event> </events> </action> </actions> </model> <model id="NewOpps" limit="" query="false" createrowifnonefound="false" adapter="" type="" sobject="Opportunity"> <fields> <field id="AccountId"/> <field id="Account.Name"/> <field id="Name"/> </fields> <conditions/> <actions> <action> <actions> <action type="cancel"> <models> <model>SelectedAccounts</model> </models> </action> </actions> <events> <event>row.created</event> </events> </action> </actions> </model> </models> <components> <pagetitle model="Account" uniqueid="sk-3xwRjG-91"> <maintitle> <template>{{Model.labelPlural}}</template> </maintitle> <subtitle> <template>Home</template> </subtitle> <actions> <action type="savecancel"/> </actions> </pagetitle> <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Account" mode="read" uniqueid="sk-3xwRjG-92"> <fields> <field id="Name" allowordering="true"/> <field id="CreatedDate" allowordering="true"/> </fields> <rowactions> <action type="edit"/> <action type="delete"/> </rowactions> <massactions usefirstitemasdefault="true"> <action type="multi" label="Create Opp for each Account" icon="sk-icon-magic"> <actions> <action type="emptyModelData"> <models> <model>SelectedAccounts</model> </models> </action> <action type="adoptRows" sourcemodel="Account" targetmodel="SelectedAccounts" model="SelectedAccounts" condition="Id" value="{{Id}}"/> <action type="markRowsForDeletion" model="SelectedAccounts"/> </actions> </action> </massactions> <views> <view type="standard"/> </views> </skootable> <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="SelectedAccounts" buttonposition="" mode="read" uniqueid="sk-3xyOwX-430"> <fields> <field id="Name"/> <field id="Id"/> </fields> <rowactions> <action type="edit"/> <action type="delete"/> </rowactions> <massactions usefirstitemasdefault="true"> <action type="massupdate"/> <action type="massdelete"/> </massactions> <views> <view type="standard"/> </views> </skootable> <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="NewOpps" buttonposition="" mode="read" uniqueid="sk-3xx9DR-176"> <fields> <field id="AccountId"/> <field id="Name"/> </fields> <rowactions> <action type="edit"/> <action type="delete"/> </rowactions> <massactions usefirstitemasdefault="true"> <action type="massupdate"/> <action type="massdelete"/> </massactions> <views> <view type="standard"/> </views> </skootable> </components> <resources> <labels/> <css/> <javascript/> </resources> <styles> <styleitem type="background" bgtype="none"/> </styles> </skuidpage> 

Hey Pat,

Thanks so much. Worked perfectly. You are a rockstar.


Quite welcome. It was fun. 😃


Pat is a Rockstar!  Good words for the day…  Thanks guys!