how to enable/disable row actions edit / delete button based on user access level on particular record

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Hi,

how to enable/disable row actions edit / delete button based on user access level.

For detail page buttons we have unique id, which helps to refer in the javascripit,

incase of row actions can we able to set unique id which we refer in javascript.

any solutions 
Photo of Vijay Rmaesh

Vijay Rmaesh

  • 210 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb
To add some detail to Vijay's question :-) :

We have an SFDC web service wrapped around the userrecordaccess object (since we can't create a Skuid model for the userrecordaccess object). We can make the Edit and Delete buttons appear or not appear based on what we get back from the webservice, but are struggling to do the same for the buttons on the rows in tables.

This, then, is Vijay's question: Can we set a unique id on the edit and delete buttons in each row of a table so we can toggle them on and off based on what we get from the call to the web service?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
So, No...  Our row actions do not yet have the ability to accept unique ID's

But another statement you've made concerns me.  You can access the objectShare sObject.  Can you not use that object to determine the users record level access? 

If the row actions are on a table where record level security would show or hide individual row's actions  - this may not be feasible.   But if this is a related list where the record level access is on a singe parent record - you should be able to pull that record's "share" record and use it for conditional rendering. 

Maybe I've rendered a lot of work unnecessary? 
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb
Rob:

Unfortunately - the edit and delete permissions can vary row by row, at least in some of the tables.

Andy
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb
@vijay If we can't hide the Delete and Edit buttons on rows in a table based on the userrecordaccess values, can we always display the buttons and have them start with javscript that calls the userrecordaccess web service? Basically - when the user clicks the delete button we check to see if they have the needed permission and if they don't have the needed permission we give them a friendly error message and if they do have the needed permission we do ahead and let them delete the record? And, for that matter, what happens today if we allow a user to try delete a row and they don't have delete permission? Can we set the error message they get or is it an ugly SFDC error?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Weeee!!! I refer to myself and others when I'm having fun.

Two models is much easier than to conditionally render a row action based on the users access level, but both are possible.



<skuidpage showsidebar="false" showheader="true" tabtooverride="Opportunities" unsavedchangeswarning="">
   <labels/>
   <models>
      <model id="OwnerData" limit="101" query="true" createrowifnonefound="false" sobject="User" orderby="Name">
         <fields>
            <field id="Name"/>
            <field id="Id"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="IsActive"/>
         </conditions>
         <actions/>
      </model>
      <model id="opportunities_All" limit="25" query="true" createrowifnonefound="false" orderby="Name" sobject="Opportunity">
         <fields>
            <field id="AccountId"/>
            <field id="Amount"/>
            <field id="CloseDate"/>
            <field id="IsClosed"/>
            <field id="Account.Name"/>
            <field id="NextStep"/>
            <field id="Name"/>
            <field id="Probability"/>
            <field id="StageName"/>
            <field id="OwnerId"/>
            <field id="Owner.Name"/>
            <field id="LeadSource"/>
            <field id="Owner.Email"/>
            <field id="CreatedDate"/>
            <field id="Account.Phone"/>
            <field id="CreatedById"/>
            <field id="CreatedBy.Name"/>
            <field id="OpportunityLineItems" type="childRelationship">
               <fields>
                  <field id="TotalPrice"/>
                  <field id="PricebookEntry.Product2.Name"/>
                  <field id="Quantity"/>
                  <field id="UnitPrice"/>
               </fields>
            </field>
            <field id="Type"/>
            <field id="CampaignId"/>
            <field id="Campaign.Name"/>
            <field id="Description"/>
            <field id="TotalOpportunityQuantity"/>
            <field id="Pricebook2Id"/>
            <field id="Pricebook2.Name"/>
            <field id="Shares" type="childRelationship" limit="10">
               <fields>
                  <field id="OpportunityAccessLevel"/>
                  <field id="OpportunityId"/>
               </fields>
            </field>
            <field id="Cirrus_Files_Nest_Under__c"/>
            <field id="Id"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" enclosevalueinquotes="true" operator="=" value="" field="StageName" name="OppStage" state="filterableoff" inactive="true"/>
            <condition type="fieldvalue" enclosevalueinquotes="true" operator="=" value="" field="LeadSource" name="OppLeadSource" state="filterableoff" inactive="true"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Type" state="filterableoff" inactive="true" name="Type"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="false" field="CloseDate" state="filterableoff" inactive="true" name="CloseDate"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="OwnerId" state="filterableoff" inactive="true" name="OwnerId"/>
            <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="IsClosed" state="filterableoff" inactive="true" name="IsClosedTrue"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="false" field="CloseDate" state="filterableoff" inactive="true" name="CloseDate1"/>
            <condition type="join" value="" field="Id" operator="in" enclosevalueinquotes="true" joinobject="OpportunityShare" joinfield="OpportunityId">
               <conditions>
                  <condition type="fieldvalue" value="All" enclosevalueinquotes="true" field="OpportunityAccessLevel" operator="="/>
               </conditions>
            </condition>
         </conditions>
         <actions/>
      </model>
      <model id="opportunities_Edit" limit="25" query="true" createrowifnonefound="false" orderby="Name" sobject="Opportunity">
         <fields>
            <field id="AccountId"/>
            <field id="Amount"/>
            <field id="CloseDate"/>
            <field id="IsClosed"/>
            <field id="Account.Name"/>
            <field id="NextStep"/>
            <field id="Name"/>
            <field id="Probability"/>
            <field id="StageName"/>
            <field id="OwnerId"/>
            <field id="Owner.Name"/>
            <field id="LeadSource"/>
            <field id="Owner.Email"/>
            <field id="CreatedDate"/>
            <field id="Account.Phone"/>
            <field id="CreatedById"/>
            <field id="CreatedBy.Name"/>
            <field id="OpportunityLineItems" type="childRelationship">
               <fields>
                  <field id="TotalPrice"/>
                  <field id="PricebookEntry.Product2.Name"/>
                  <field id="Quantity"/>
                  <field id="UnitPrice"/>
               </fields>
            </field>
            <field id="Type"/>
            <field id="CampaignId"/>
            <field id="Campaign.Name"/>
            <field id="Description"/>
            <field id="TotalOpportunityQuantity"/>
            <field id="Pricebook2Id"/>
            <field id="Pricebook2.Name"/>
            <field id="Shares" type="childRelationship" limit="10">
               <fields>
                  <field id="OpportunityAccessLevel"/>
                  <field id="OpportunityId"/>
               </fields>
            </field>
            <field id="Cirrus_Files_Nest_Under__c"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" enclosevalueinquotes="true" operator="=" value="" field="StageName" name="OppStage" state="filterableoff" inactive="true"/>
            <condition type="fieldvalue" enclosevalueinquotes="true" operator="=" value="" field="LeadSource" name="OppLeadSource" state="filterableoff" inactive="true"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Type" state="filterableoff" inactive="true" name="Type"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="false" field="CloseDate" state="filterableoff" inactive="true" name="CloseDate"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="OwnerId" state="filterableoff" inactive="true" name="OwnerId"/>
            <condition type="fieldvalue" value="true" enclosevalueinquotes="false" field="IsClosed" state="filterableoff" inactive="true" name="IsClosedTrue"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="false" field="CloseDate" state="filterableoff" inactive="true" name="CloseDate1"/>
            <condition type="join" value="" field="Id" operator="in" enclosevalueinquotes="true" joinobject="OpportunityShare" joinfield="OpportunityId">
               <conditions>
                  <condition type="fieldvalue" value="Edit" enclosevalueinquotes="true" field="OpportunityAccessLevel" operator="="/>
               </conditions>
            </condition>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="opportunities_Edit">
         <actions>
            <!--
            <action type="redirect" label="Standard Page" window="self" icon="ui-silk-application-form" url="/{{Model.KeyPrefix}}/o?nooverride=1"/>
            -->
            <action type="savecancel" label="New Action">
               <cancelhotkeys/>
            </action>
         </actions>
         <subtitle>Home</subtitle>
         <maintitle>{{Model.LabelPlural}}</maintitle>
         <renderconditions logictype="and"/>
      </pagetitle>
      <tabset rememberlastusertab="true" defertabrendering="true" renderas="">
         <tabs>
            <tab name="All">
               <components>
                  <skootable showconditions="true" showsavecancel="false" searchbox="true" searchmethod="server" createrecords="false" model="opportunities_All" pagesize="10" showexportbuttons="true" mode="read">
                     <fields>
                        <field id="Name" allowordering="true" columnwidth="20%"/>
                        <field id="Type"/>
                        <field id="Amount" countBlanks="false" allowordering="true">
                           <summaries>
                              <summary>sum</summary>
                              <summary>avg</summary>
                           </summaries>
                        </field>
                        <field id="TotalOpportunityQuantity" allowordering="true" readonly="true">
                           <summaries>
                              <summary>sum</summary>
                              <summary>avg</summary>
                           </summaries>
                        </field>
                        <field id="AccountId" allowordering="true" type="REFPICK">
                           <label>Company Name</label>
                        </field>
                        <field id="StageName" allowordering="true" type=""/>
                        <field id="Probability"/>
                        <field id="CloseDate" allowordering="true"/>
                        <field id="OwnerId">
                           <label>Owner</label>
                        </field>
                        <field id="Shares" type="CHILDREL" limit="100" valuehalign="" delimiter="," allowhtml="true">
                           <label>Opportunity Access</label>
                           <template>&lt;div id="{{OpportunityId}}"&gt;{{OpportunityAccessLevel}}&lt;/div&gt;</template>
                        </field>
                     </fields>
                     <rowactions>
                        <action type="edit"/>
                        <action type="redirect" label="Email Owner" url="/_ui/core/email/author/EmailAuthor?rtype=003&amp;p24={{{Owner.Email}}}&amp;p3_lkid={{{Id}}}&amp;retURL=%2F006%2Fo" icon="ui-silk-email-go" window="self"/>
                        <action type="popup" window="self" icon="ui-silk-application" label="View Opportunity Details">
                           <popup title="{{Name}}" width="90%">
                              <components>
                                 <pagetitle model="opportunities_Edit">
                                    <maintitle>{{{Name}}}</maintitle>
                                    <subtitle>
                                       <template>{{Model.Label}}</template>
                                    </subtitle>
                                    <actions>
                                       <action type="redirect" window="self" label="Open Full Detail" icon="ui-silk-application-go" url="/{{{Id}}}"/>
                                       <action type="savecancel" label="" snippet="" icon="">
                                          <models/>
                                       </action>
                                    </actions>
                                    <conditions>
                                       <condition type="contextrow" field="Id" autocreated="true"/>
                                    </conditions>
                                 </pagetitle>
                                 <tabset rememberlastusertab="true" defertabrendering="true">
                                    <tabs>
                                       <tab name="Basics" icon="ui-silk-award-star-gold-2">
                                          <components>
                                             <basicfieldeditor showheader="true" showsavecancel="false" model="opportunities_Edit" mode="read" layout="above" buttonposition="">
                                                <columns>
                                                   <column width="50%">
                                                      <sections>
                                                         <section title="Opportunity Details">
                                                            <fields>
                                                               <field id="AccountId">
                                                                  <label>Company</label>
                                                               </field>
                                                               <field id="Amount"/>
                                                               <field id="OwnerId">
                                                                  <label>Owner</label>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                         <section title="Line Items">
                                                            <fields>
                                                               <field id="OpportunityLineItems" type="CHILDREL" limit="100" delimiter="&lt;br/&gt;">
                                                                  <label>Quantity of Product at Sales Price</label>
                                                                  <template>{{Quantity}} {{PricebookEntry.Product2.Name}} @ {{UnitPrice}}</template>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                   <column width="50%">
                                                      <sections>
                                                         <section title="Status">
                                                            <fields>
                                                               <field id="CloseDate"/>
                                                               <field id="NextStep"/>
                                                               <field id="Probability"/>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                </columns>
                                                <conditions>
                                                   <condition type="contextrow" field="Id" autocreated="true"/>
                                                </conditions>
                                             </basicfieldeditor>
                                          </components>
                                       </tab>
                                       <tab name="Line Items" icon="ui-silk-cart">
                                          <components>
                                             <basicfieldeditor showheader="true" showsavecancel="false" model="opportunities_Edit" mode="read" uniqueid="SelectPricebook">
                                                <columns>
                                                   <column width="50%">
                                                      <sections>
                                                         <section title="Opportunity Pricebook">
                                                            <fields>
                                                               <field id="Pricebook2Id" required="false" type="REFPICK" optionsource="model" optionmodel="Pricebooks" displaytemplate="{{Name}}">
                                                                  <filters/>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                </columns>
                                                <conditions>
                                                   <condition type="contextrow" field="Id"/>
                                                </conditions>
                                             </basicfieldeditor>
                                             <custom name="HideLineItemsTableIfNoPricebook_ExistingOpp"/>
                                          </components>
                                       </tab>
                                    </tabs>
                                 </tabset>
                                 <custom name="LoadChildData"/>
                              </components>
                           </popup>
                        </action>
                        <action type="redirect" label="Clone" url="/{{Id}}/e?clone=1" icon="ui-silk-arrow-branch" window="self"/>
                     </rowactions>
                     <actions defaultlabel="Global Actions" defaulticon="ui-silk-wand" usefirstitemasdefault="true">
                        <action type="multi" label="New Opp in Popup" icon="sk-icon-add">
                           <actions>
                              <action type="createRow" model="opportunities" appendorprepend="append" defaultmodefornewitems="edit"/>
                              <action type="showPopup">
                                 <popup title="New Opportunity" uniqueid="newOppPopup" width="90%">
                                    <components>
                                       <pagetitle model="opportunities_Edit" uniqueid="popupPageTitle">
                                          <maintitle>
                                             <template>{{Name}}</template>
                                          </maintitle>
                                          <subtitle>
                                             <template>{{Model.label}}</template>
                                          </subtitle>
                                          <actions>
                                             <action type="multi" label="Save and Close" icon="sk-icon-save">
                                                <actions>
                                                   <action type="blockUI" message="Saving"/>
                                                   <action type="save">
                                                      <models>
                                                         <model>opportunities</model>
                                                      </models>
                                                      <onerroractions>
                                                         <action type="blockUI" message="There was an error saving Opportunity" timeout="3000"/>
                                                      </onerroractions>
                                                   </action>
                                                   <action type="closeTopmostPopup"/>
                                                   <action type="unblockUI"/>
                                                </actions>
                                             </action>
                                          </actions>
                                       </pagetitle>
                                       <basicfieldeditor showheader="true" showsavecancel="false" model="opportunities_Edit" buttonposition="" mode="edit" layout="">
                                          <columns>
                                             <column width="33.3%">
                                                <sections>
                                                   <section title="Basic Information" collapsible="no">
                                                      <fields>
                                                         <field id="Name"/>
                                                         <field id="AccountId"/>
                                                         <field id="Type"/>
                                                         <field id="Description"/>
                                                      </fields>
                                                   </section>
                                                </sections>
                                             </column>
                                             <column width="33.3%">
                                                <sections>
                                                   <section title="Sales Process" collapsible="no">
                                                      <fields>
                                                         <field id="StageName"/>
                                                         <field id="CloseDate"/>
                                                         <field id="NextStep"/>
                                                      </fields>
                                                   </section>
                                                </sections>
                                             </column>
                                             <column width="33.3%">
                                                <sections>
                                                   <section title="System Information" collapsible="no">
                                                      <fields>
                                                         <field id="LeadSource"/>
                                                         <field id="CampaignId"/>
                                                         <field id="OwnerId"/>
                                                      </fields>
                                                   </section>
                                                </sections>
                                             </column>
                                          </columns>
                                          <conditions>
                                             <condition type="contextrow" field="Id" mergefield="Id"/>
                                          </conditions>
                                       </basicfieldeditor>
                                    </components>
                                 </popup>
                              </action>
                              <action type="custom" snippet="listenForPopupClose"/>
                           </actions>
                        </action>
                     </actions>
                     <massactions defaultlabel="Mass Actions" defaulticon="ui-silk-wand" usefirstitemasdefault="true">
                        <action type="massupdate"/>
                        <action type="massdelete"/>
                        <action type="massedit"/>
                     </massactions>
                     <filters>
                        <filter type="select" filteroffoptionlabel="Any Close Date" createfilteroffoption="true" condition="CloseDate">
                           <sources>
                              <source type="manual">
                                 <options>
                                    <option label="Closing: This Month" type="simple" value="THIS_MONTH"/>
                                    <option label="Closing: Next 30 Days" type="simple" value="NEXT_N_DAYS:30"/>
                                    <option label="Closing: Next 90 Days" type="simple" value="NEXT_N_DAYS:90"/>
                                    <option label="Closing: This Fiscal Quarter" type="simple" value="THIS_FISCAL_QUARTER"/>
                                    <option label="Closing: Next Fiscal Quarter" type="simple" value="NEXT_FISCAL_QUARTER"/>
                                    <option label="Closing: This Year" type="simple" value="THIS_YEAR"/>
                                    <option label="Closing: Last 30 Days" type="simple" value="LAST_N_DAYS:30"/>
                                    <option label="Closing: Last 90 Days" type="simple" value="LAST_N_DAYS:90"/>
                                    <option label="Closing: Last Year" type="simple" value="LAST_YEAR"/>
                                 </options>
                              </source>
                           </sources>
                        </filter>
                        <filter type="select" filteroffoptionlabel="Any Stage" createfilteroffoption="true" condition="OppStage">
                           <sources>
                              <source type="metadata" effectsbehavior="justdefault"/>
                              <source type="manual">
                                 <options>
                                    <option label="Random Group" type="complex">
                                       <effects>
                                          <effect action="set" value="Prospecting" condition="OppStage"/>
                                          <effect action="set" value="Qualification" condition="OppStage"/>
                                       </effects>
                                    </option>
                                 </options>
                              </source>
                           </sources>
                        </filter>
                        <filter type="select" filteroffoptionlabel="Any Type" createfilteroffoption="true" condition="Type">
                           <sources>
                              <source type="metadata" prefix="Type: "/>
                           </sources>
                        </filter>
                        <filter type="select" filteroffoptionlabel="Any Owner" createfilteroffoption="true" affectcookies="true" condition="OwnerId">
                           <sources>
                              <source type="model" model="OwnerData" effectsbehavior="justdefault">
                                 <labeltemplate>Owner: {{{Name}}}</labeltemplate>
                                 <valuetemplate>{{Id}}</valuetemplate>
                              </source>
                           </sources>
                        </filter>
                        <filter type="toggle" filteroffoptionlabel="New Filter" createfilteroffoption="true" affectcookies="true" label="Just Closed Opportunities">
                           <effects>
                              <effect action="activate" value="" condition="IsClosedTrue"/>
                           </effects>
                        </filter>
                     </filters>
                     <exportproperties usetablecolumns="true"/>
                     <renderconditions logictype="and"/>
                  </skootable>
               </components>
            </tab>
            <tab name="Edit" loadlazypanels="true">
               <components>
                  <skootable showconditions="true" showsavecancel="false" searchbox="true" searchmethod="server" createrecords="false" model="opportunities_Edit" pagesize="10" showexportbuttons="true" mode="read">
                     <fields>
                        <field id="Name" allowordering="true" columnwidth="20%"/>
                        <field id="Type"/>
                        <field id="Amount" countBlanks="false" allowordering="true">
                           <summaries>
                              <summary>sum</summary>
                              <summary>avg</summary>
                           </summaries>
                        </field>
                        <field id="TotalOpportunityQuantity" allowordering="true" readonly="true">
                           <summaries>
                              <summary>sum</summary>
                              <summary>avg</summary>
                           </summaries>
                        </field>
                        <field id="AccountId" allowordering="true" type="REFPICK">
                           <label>Company Name</label>
                        </field>
                        <field id="StageName" allowordering="true" type=""/>
                        <field id="Probability"/>
                        <field id="CloseDate" allowordering="true"/>
                        <field id="OwnerId">
                           <label>Owner</label>
                        </field>
                        <field id="Shares" type="CHILDREL" limit="100" valuehalign="" delimiter="," allowhtml="true">
                           <label>Opportunity Access</label>
                           <template>&lt;div id="{{OpportunityId}}"&gt;{{OpportunityAccessLevel}}&lt;/div&gt;</template>
                        </field>
                     </fields>
                     <rowactions>
                        <action type="edit"/>
                        <action type="delete">
                           <renderconditions logictype="and"/>
                        </action>
                        <action type="redirect" label="Email Owner" url="/_ui/core/email/author/EmailAuthor?rtype=003&amp;p24={{{Owner.Email}}}&amp;p3_lkid={{{Id}}}&amp;retURL=%2F006%2Fo" icon="ui-silk-email-go" window="self"/>
                        <action type="popup" window="self" icon="ui-silk-application" label="View Opportunity Details">
                           <popup title="{{Name}}" width="90%">
                              <components>
                                 <pagetitle model="opportunities_Edit">
                                    <maintitle>{{{Name}}}</maintitle>
                                    <subtitle>
                                       <template>{{Model.Label}}</template>
                                    </subtitle>
                                    <actions>
                                       <action type="redirect" window="self" label="Open Full Detail" icon="ui-silk-application-go" url="/{{{Id}}}"/>
                                       <action type="savecancel" label="" snippet="" icon="">
                                          <models/>
                                       </action>
                                    </actions>
                                    <conditions>
                                       <condition type="contextrow" field="Id" autocreated="true"/>
                                    </conditions>
                                 </pagetitle>
                                 <tabset rememberlastusertab="true" defertabrendering="true">
                                    <tabs>
                                       <tab name="Basics" icon="ui-silk-award-star-gold-2">
                                          <components>
                                             <basicfieldeditor showheader="true" showsavecancel="false" model="opportunities_Edit" mode="read" layout="above" buttonposition="">
                                                <columns>
                                                   <column width="50%">
                                                      <sections>
                                                         <section title="Opportunity Details">
                                                            <fields>
                                                               <field id="AccountId">
                                                                  <label>Company</label>
                                                               </field>
                                                               <field id="Amount"/>
                                                               <field id="OwnerId">
                                                                  <label>Owner</label>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                         <section title="Line Items">
                                                            <fields>
                                                               <field id="OpportunityLineItems" type="CHILDREL" limit="100" delimiter="&lt;br/&gt;">
                                                                  <label>Quantity of Product at Sales Price</label>
                                                                  <template>{{Quantity}} {{PricebookEntry.Product2.Name}} @ {{UnitPrice}}</template>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                   <column width="50%">
                                                      <sections>
                                                         <section title="Status">
                                                            <fields>
                                                               <field id="CloseDate"/>
                                                               <field id="NextStep"/>
                                                               <field id="Probability"/>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                </columns>
                                                <conditions>
                                                   <condition type="contextrow" field="Id" autocreated="true"/>
                                                </conditions>
                                             </basicfieldeditor>
                                          </components>
                                       </tab>
                                       <tab name="Line Items" icon="ui-silk-cart">
                                          <components>
                                             <basicfieldeditor showheader="true" showsavecancel="false" model="opportunities_Edit" mode="read" uniqueid="SelectPricebook">
                                                <columns>
                                                   <column width="50%">
                                                      <sections>
                                                         <section title="Opportunity Pricebook">
                                                            <fields>
                                                               <field id="Pricebook2Id" required="false" type="REFPICK" optionsource="model" optionmodel="Pricebooks" displaytemplate="{{Name}}">
                                                                  <filters/>
                                                               </field>
                                                            </fields>
                                                         </section>
                                                      </sections>
                                                   </column>
                                                </columns>
                                                <conditions>
                                                   <condition type="contextrow" field="Id"/>
                                                </conditions>
                                             </basicfieldeditor>
                                             <custom name="HideLineItemsTableIfNoPricebook_ExistingOpp"/>
                                          </components>
                                       </tab>
                                    </tabs>
                                 </tabset>
                                 <custom name="LoadChildData"/>
                              </components>
                           </popup>
                        </action>
                        <action type="redirect" label="Clone" url="/{{Id}}/e?clone=1" icon="ui-silk-arrow-branch" window="self"/>
                     </rowactions>
                     <actions defaultlabel="Global Actions" defaulticon="ui-silk-wand" usefirstitemasdefault="true">
                        <action type="multi" label="New Opp in Popup" icon="sk-icon-add">
                           <actions>
                              <action type="createRow" model="opportunities" appendorprepend="append" defaultmodefornewitems="edit"/>
                              <action type="showPopup">
                                 <popup title="New Opportunity" uniqueid="newOppPopup" width="90%">
                                    <components>
                                       <pagetitle model="opportunities_Edit" uniqueid="popupPageTitle">
                                          <maintitle>
                                             <template>{{Name}}</template>
                                          </maintitle>
                                          <subtitle>
                                             <template>{{Model.label}}</template>
                                          </subtitle>
                                          <actions>
                                             <action type="multi" label="Save and Close" icon="sk-icon-save">
                                                <actions>
                                                   <action type="blockUI" message="Saving"/>
                                                   <action type="save">
                                                      <models>
                                                         <model>opportunities</model>
                                                      </models>
                                                      <onerroractions>
                                                         <action type="blockUI" message="There was an error saving Opportunity" timeout="3000"/>
                                                      </onerroractions>
                                                   </action>
                                                   <action type="closeTopmostPopup"/>
                                                   <action type="unblockUI"/>
                                                </actions>
                                             </action>
                                          </actions>
                                       </pagetitle>
                                       <basicfieldeditor showheader="true" showsavecancel="false" model="opportunities_Edit" buttonposition="" mode="edit" layout="">
                                          <columns>
                                             <column width="33.3%">
                                                <sections>
                                                   <section title="Basic Information" collapsible="no">
                                                      <fields>
                                                         <field id="Name"/>
                                                         <field id="AccountId"/>
                                                         <field id="Type"/>
                                                         <field id="Description"/>
                                                      </fields>
                                                   </section>
                                                </sections>
                                             </column>
                                             <column width="33.3%">
                                                <sections>
                                                   <section title="Sales Process" collapsible="no">
                                                      <fields>
                                                         <field id="StageName"/>
                                                         <field id="CloseDate"/>
                                                         <field id="NextStep"/>
                                                      </fields>
                                                   </section>
                                                </sections>
                                             </column>
                                             <column width="33.3%">
                                                <sections>
                                                   <section title="System Information" collapsible="no">
                                                      <fields>
                                                         <field id="LeadSource"/>
                                                         <field id="CampaignId"/>
                                                         <field id="OwnerId"/>
                                                      </fields>
                                                   </section>
                                                </sections>
                                             </column>
                                          </columns>
                                          <conditions>
                                             <condition type="contextrow" field="Id" mergefield="Id"/>
                                          </conditions>
                                       </basicfieldeditor>
                                    </components>
                                 </popup>
                              </action>
                              <action type="custom" snippet="listenForPopupClose"/>
                           </actions>
                        </action>
                     </actions>
                     <massactions defaultlabel="Mass Actions" defaulticon="ui-silk-wand" usefirstitemasdefault="true">
                        <action type="massupdate"/>
                        <action type="massdelete"/>
                        <action type="massedit"/>
                     </massactions>
                     <filters>
                        <filter type="select" filteroffoptionlabel="Any Close Date" createfilteroffoption="true" condition="CloseDate">
                           <sources>
                              <source type="manual">
                                 <options>
                                    <option label="Closing: This Month" type="simple" value="THIS_MONTH"/>
                                    <option label="Closing: Next 30 Days" type="simple" value="NEXT_N_DAYS:30"/>
                                    <option label="Closing: Next 90 Days" type="simple" value="NEXT_N_DAYS:90"/>
                                    <option label="Closing: This Fiscal Quarter" type="simple" value="THIS_FISCAL_QUARTER"/>
                                    <option label="Closing: Next Fiscal Quarter" type="simple" value="NEXT_FISCAL_QUARTER"/>
                                    <option label="Closing: This Year" type="simple" value="THIS_YEAR"/>
                                    <option label="Closing: Last 30 Days" type="simple" value="LAST_N_DAYS:30"/>
                                    <option label="Closing: Last 90 Days" type="simple" value="LAST_N_DAYS:90"/>
                                    <option label="Closing: Last Year" type="simple" value="LAST_YEAR"/>
                                 </options>
                              </source>
                           </sources>
                        </filter>
                        <filter type="select" filteroffoptionlabel="Any Stage" createfilteroffoption="true" condition="OppStage">
                           <sources>
                              <source type="metadata" effectsbehavior="justdefault"/>
                              <source type="manual">
                                 <options>
                                    <option label="Random Group" type="complex">
                                       <effects>
                                          <effect action="set" value="Prospecting" condition="OppStage"/>
                                          <effect action="set" value="Qualification" condition="OppStage"/>
                                       </effects>
                                    </option>
                                 </options>
                              </source>
                           </sources>
                        </filter>
                        <filter type="select" filteroffoptionlabel="Any Type" createfilteroffoption="true" condition="Type">
                           <sources>
                              <source type="metadata" prefix="Type: "/>
                           </sources>
                        </filter>
                        <filter type="select" filteroffoptionlabel="Any Owner" createfilteroffoption="true" affectcookies="true" condition="OwnerId">
                           <sources>
                              <source type="model" model="OwnerData" effectsbehavior="justdefault">
                                 <labeltemplate>Owner: {{{Name}}}</labeltemplate>
                                 <valuetemplate>{{Id}}</valuetemplate>
                              </source>
                           </sources>
                        </filter>
                        <filter type="toggle" filteroffoptionlabel="New Filter" createfilteroffoption="true" affectcookies="true" label="Just Closed Opportunities">
                           <effects>
                              <effect action="activate" value="" condition="IsClosedTrue"/>
                           </effects>
                        </filter>
                     </filters>
                     <exportproperties usetablecolumns="true"/>
                     <renderconditions logictype="and"/>
                  </skootable>
               </components>
            </tab>
         </tabs>
      </tabset>
   </components>
   <resources>
      <labels/>
      <javascript>
         <jsitem location="inlinesnippet" name="listenForPopupClose" cachelocation="false">var params = arguments[0],
	$ = skuid.$,
	oppModel = skuid.$M('opportunities');

    skuid.$(".ui-dialog-content").dialog({
    "beforeClose" : function()
      {
        //put your event-handler code here.
        oppModel.cancel();
      }
    });</jsitem>
         <jsitem location="inline" name="newInlineJS" cachelocation="false" url="">(function(skuid){
	var $ = skuid.$;
	$(function(){

        var oppModel = skuid.$M('opportunities_All');
        
        $.each(oppModel.data, function(r,oppRow){
            var pound = "#",
                oppId = oppRow.Id,
                oppIdId = pound.concat(oppId);
            if($(oppIdId).text().indexOf("Edit") == -1) {
    
                $(oppIdId).closest('tr').find('.nx-skootable-buttonicon.editrow').hide();
    
            }
        });
        

 
	});
})(skuid);</jsitem>
      </javascript>
      <css/>
   </resources>
</skuidpage>
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks Pat.  Another innovative way to get things done.