view/download prior version XML without saving

  • 1
  • Idea
  • Updated 4 years ago
If I want to go back and grab old versions of my page, right now the only way to do it is to revert to an older version, save the page, view the XML, download it, revert back to my previous/good version, and save the page again. This doesn't work if you have a page in use and you need to pull an older version of the XML in order to, say, do a comparison, because you don't want to have to save the page to an old version while it is in use.

Can we get an easy way to extract the XML of older versions of a page without requiring that you first save the page to that older version?
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Here you go. Page List with a new row action to show XML of page version. You can select and copy it. Not to worry about the lack of formatting. Creating a new page using the copied XML gets beautified.





<skuidpage tabtooverride="" showsidebar="true" theme="" unsavedchangeswarning="">
   <models>
      <model id="pagedata" sobject="skuid__Page__c" order="name" orderby="LastModifiedDate DESC" query="true" limit="25">
         <fields>
            <field id="Id"/>
            <field id="skuid__Module__c"/>
            <field id="Name"/>
            <field id="LastModifiedDate"/>
            <field id="LastModifiedById"/>
            <field id="LastModifiedBy.Name"/>
            <field id="CreatedById"/>
            <field id="CreatedBy.Name"/>
            <field id="CreatedDate"/>
            <field id="skuid__Type__c"/>
         </fields>
         <conditions logic="">
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" operator="=" field="skuid__Module__c" allowfiltering="true" inactive="true" name="PagesModule" state="filterableoff"/>
            <condition type="userinfo" value="userid" operator="=" field="LastModifiedById" allowfiltering="true" name="LastModByMe" inactive="true"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="false" operator="=" field="LastModifiedDate" allowfiltering="true" name="LastModDate" inactive="true"/>
            <condition type="userinfo" value="userid" operator="=" field="CreatedById" allowfiltering="true" inactive="true" name="CreatedByMe"/>
            <condition type="fieldvalue" value="" enclosevalueinquotes="false" operator="=" field="CreatedDate" allowfiltering="true" name="CreatedDate" inactive="true"/>
            <condition type="fieldvalue" value="Mobile" enclosevalueinquotes="true" field="skuid__Type__c" state="filterableoff" inactive="true" name="IsMobilePage"/>
            <condition type="fieldvalue" value="Mobile" field="skuid__Type__c" operator="!=" state="filterableoff" enclosevalueinquotes="true" name="IsDesktopPage"/>
            <condition type="blank" value="null" field="skuid__Module__c" operator="=" enclosevalueinquotes="false" state="filterableon" inactive="false" name="NoModule"/>
         </conditions>
         <actions/>
      </model>
      <model id="PagesInStaticResources" limit="10" query="true" createrowifnonefound="false" sobject="StaticResource" doclone="" type="" orderby="Name">
         <fields>
            <field id="Name"/>
            <field id="BodyLength"/>
            <field id="Description"/>
            <field id="Id"/>
            <field id="LastModifiedById"/>
            <field id="LastModifiedBy.Name"/>
            <field id="LastModifiedDate"/>
            <field id="NamespacePrefix"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" value="application/json" field="ContentType" operator="=" enclosevalueinquotes="true"/>
            <condition type="fieldvalue" value="skuid" enclosevalueinquotes="true" field="NamespacePrefix" operator="!=" state="off" inactive="true"/>
         </conditions>
         <actions/>
      </model>
      <model id="__PageModuleForPackaging__" limit="1" query="false" createrowifnonefound="true" sobject="skuid__Page__c">
         <fields>
            <field id="skuid__Module__c"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
      <model id="__StaticResourceInfoForPackaging__" limit="1" query="false" createrowifnonefound="true" sobject="StaticResource" type="">
         <fields>
            <field id="NamespacePrefix"/>
            <field id="Name"/>
            <field id="Description"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
      <model id="__SelectedPage__" limit="1" query="false" createrowifnonefound="false" sobject="skuid__Page__c">
         <fields>
            <field id="skuid__Layout__c"/>
            <field id="skuid__Layout2__c"/>
            <field id="skuid__Layout3__c"/>
            <field id="skuid__Layout4__c"/>
            <field id="skuid__Layout5__c"/>
            <field id="Name"/>
            <field id="CreatedById"/>
            <field id="CreatedBy.Name"/>
            <field id="CreatedDate"/>
            <field id="LastModifiedById"/>
            <field id="LastModifiedBy.Name"/>
            <field id="LastModifiedDate"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" state="filterableoff" inactive="true" name="Id"/>
         </conditions>
         <actions/>
      </model>
      <model id="__SelectedPageVersions__" limit="20" query="false" createrowifnonefound="false" sobject="skuid__Page_Version__c" orderby="CreatedDate DESC">
         <fields>
            <field id="skuid__Description__c"/>
            <field id="skuid__IsAutoSave__c"/>
            <field id="Name"/>
            <field id="CreatedDate"/>
            <field id="skuid__Layout__c"/>
            <field id="skuid__Layout2__c"/>
            <field id="skuid__Layout3__c"/>
            <field id="skuid__Layout4__c"/>
            <field id="skuid__Layout5__c"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="skuid__Page__c" state="filterableoff" inactive="true" name="skuid__Page__c"/>
            <condition type="fieldvalue" value="false" enclosevalueinquotes="false" field="skuid__IsAutoSave__c" state="filterableoff" inactive="true" name="IsNotAutoSave"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="pagedata">
         <actions>
            <action type="savecancel" window="self">
               <savehotkeys>
                  <hotkey modifiers="ctrl" key="s"/>
                  <hotkey modifiers="meta" key="s"/>
               </savehotkeys>
            </action>
         </actions>
         <subtitle>{{Model.LabelPlural}}</subtitle>
         <maintitle>Home</maintitle>
      </pagetitle>
      <skootable id="pagelist" editrecords="true" deleterecords="true" createrecords="false" model="pagedata" pagesize="10" searchbox="true" showconditions="true" title="Pages" showsavecancel="false" showexportbuttons="false" mode="read">
         <fields>
            <field id="Name" allowordering="true"/>
            <field id="skuid__Module__c"/>
            <field id="LastModifiedById" readonly="true" allowordering="true">
               <label>Last Modified By</label>
            </field>
            <field id="LastModifiedDate" allowordering="true" readonly="true">
               <label>Last Modified</label>
            </field>
            <field type="COMBO" readonly="readonly">
               <label>Created By</label>
               <template model="pagedata" multiple="multiple">{{CreatedById}}, {{CreatedDate}}</template>
            </field>
         </fields>
         <actions defaultlabel="Global Actions" defaulticon="ui-silk-wand" usefirstitemasdefault="true">
            <action type="redirect" label="Create New Page" url="/{{Model.KeyPrefix}}/e" icon="sk-icon-page-add" window="self">
               <hotkeys>
                  <hotkey modifiers="shift" key="n" ignoretextinputs="true"/>
               </hotkeys>
            </action>
            <action type="redirect" label="Import Pages" url="/apex/skuid__Import?obj=skuid__Page__c" icon="sk-icon-page-import" window="self"/>
            <action type="custom" label="Export All Pages" snippet="skuid.pages.exportAllPages" icon="sk-icon-page-export"/>
            <action type="popup" window="self" label="Package Pages in Module" icon="sk-icon-page-package">
               <popup title="Package Pages in Module(s)" width="800">
                  <components>
                     <pagetitle model="__PageModuleForPackaging__">
                        <maintitle>Package Pages in Module(s)</maintitle>
                        <subtitle>
                           <template>{{Model.label}}</template>
                        </subtitle>
                        <actions>
                           <action type="custom" label="Package" snippet="skuid.page.packagePagesInModules" icon="sk-icon-page-package">
                              <renderconditions logictype="and"/>
                              <hotkeys>
                                 <hotkey modifiers="" key="return" ignoretextinputs="true"/>
                              </hotkeys>
                           </action>
                        </actions>
                        <renderconditions/>
                     </pagetitle>
                     <basicfieldeditor showheader="true" showsavecancel="false" model="__PageModuleForPackaging__" buttonposition="" mode="edit">
                        <columns>
                           <column width="100%">
                              <sections>
                                 <section title="Select Module(s)...">
                                    <fields>
                                       <field id="skuid__Module__c" showhelp="false" type="CUSTOM" snippet="Multipicklist" required="true" valuehalign="">
                                          <renderconditions/>
                                          <label>Module(s)</label>
                                       </field>
                                    </fields>
                                 </section>
                              </sections>
                           </column>
                        </columns>
                     </basicfieldeditor>
                  </components>
               </popup>
               <drawer title="Drawer Area" width="90%" closehandle="true">
                  <components/>
               </drawer>
               <hotkeys>
                  <hotkey modifiers="meta" key="p" ignoretextinputs="true"/>
                  <hotkey modifiers="ctrl" key="p" ignoretextinputs="true"/>
               </hotkeys>
            </action>
            <action type="popup" label="Unpack Pages" icon="sk-icon-briefcase">
               <popup title="Unpack Page(s)" width="80%">
                  <components>
                     <pagetitle model="PagesInStaticResources">
                        <maintitle>Unpack Page(s) in Skuid Page Pack(s)</maintitle>
                        <actions>
                           <action type="custom" label="Unpack" window="self" snippet="skuid.pageList.refreshPages">
                              <renderconditions logictype="and"/>
                              <hotkeys>
                                 <hotkey modifiers="" key="return" ignoretextinputs="true"/>
                              </hotkeys>
                           </action>
                        </actions>
                     </pagetitle>
                     <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="PagesInStaticResources" buttonposition="left" mode="readonly" uniqueid="pageSRSelect" searchplaceholdertext="Enter the name of a Pack..." emptysearchbehavior="query">
                        <fields>
                           <field type="COMBO" allowhtml="true" columnwidth="1%" valuehalign="">
                              <template>&lt;input type="checkbox" value="{{{Id}}}" id="pagestoimport" class="nx-checkbox"/&gt;</template>
                           </field>
                           <field id="Name" allowordering="true"/>
                           <field id="NamespacePrefix" valuehalign="" type="" readonly="true">
                              <label>Namespace</label>
                           </field>
                           <field id="BodyLength" type="CUSTOM" snippet="skuid.pageList.bytesToKBs"/>
                           <field id="Description"/>
                        </fields>
                        <rowactions/>
                        <massactions usefirstitemasdefault="true"/>
                        <views>
                           <view type="standard"/>
                        </views>
                        <searchfields/>
                     </skootable>
                  </components>
               </popup>
               <hotkeys>
                  <hotkey modifiers="meta" key="u" ignoretextinputs="true"/>
                  <hotkey modifiers="ctrl" key="u" ignoretextinputs="true"/>
               </hotkeys>
               <drawer title="Drawer Area" width="90%" closehandle="true">
                  <components/>
               </drawer>
            </action>
         </actions>
         <rowactions>
            <action type="redirect" label="Edit Page" url="/{{Id}}/e" icon="sk-icon-page-edit" window="self"/>
            <action type="custom" window="self" label="Preview" icon="sk-icon-preview" snippet="skuid.pageList.previewPage"/>
            <action type="multi" label="Versions" icon="sk-icon-versions">
               <actions>
                  <action type="blockUI" message="Loading Page Versions..."/>
                  <action type="setCondition" model="__SelectedPageVersions__" condition="skuid__Page__c" value="{{{Id}}}"/>
                  <action type="setCondition" model="__SelectedPage__" condition="Id" value="{{{Id}}}"/>
                  <action type="requeryModels" model="__SelectedPageVersions__">
                     <models>
                        <model>__SelectedPage__</model>
                        <model>__SelectedPageVersions__</model>
                     </models>
                  </action>
                  <action type="showPopup">
                     <popup title="Viewing Page Versions" width="80%">
                        <components>
                           <pagetitle model="__SelectedPage__">
                              <maintitle>Versions of Page: {{Name}}</maintitle>
                              <actions>
                                 <action type="redirect" label="Edit Page" window="self" icon="sk-icon-page-edit" url="/apex/skuid__PageBuilder?id={{Id}}"/>
                                 <action type="custom" label="Preview Page" window="self" snippet="skuid.pageList.previewPage" icon="sk-icon-preview"/>
                                 <action type="multi" label="Close Popup" window="self" icon="sk-icon-cancel">
                                    <actions>
                                       <action type="closeAllPopups"/>
                                       <action type="cancel">
                                          <models>
                                             <model>__SelectedPage__</model>
                                             <model>__SelectedPageVersions__</model>
                                          </models>
                                       </action>
                                    </actions>
                                    <hotkeys/>
                                    <renderconditions/>
                                 </action>
                              </actions>
                              <conditions/>
                              <renderconditions/>
                           </pagetitle>
                           <basicfieldeditor showheader="true" showsavecancel="false" model="__SelectedPage__" buttonposition="" mode="readonly" layout="above">
                              <columns>
                                 <column width="50%">
                                    <sections>
                                       <section title="Page Last Modified" collapsible="no">
                                          <fields>
                                             <field type="COMBO" editmodebehavior="autopopup" valuehalign="">
                                                <template>{{LastModifiedById}}, {{LastModifiedDate}}</template>
                                             </field>
                                          </fields>
                                       </section>
                                    </sections>
                                 </column>
                                 <column width="50%">
                                    <sections>
                                       <section title="Page Created" collapsible="no">
                                          <fields>
                                             <field type="COMBO" editmodebehavior="autopopup">
                                                <template>{{CreatedById}}, {{CreatedDate}}</template>
                                             </field>
                                          </fields>
                                       </section>
                                    </sections>
                                 </column>
                              </columns>
                           </basicfieldeditor>
                           <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="__SelectedPageVersions__" buttonposition="" mode="read">
                              <fields>
                                 <field id="skuid__Description__c"/>
                                 <field id="skuid__IsAutoSave__c"/>
                                 <field id="CreatedDate" allowordering="true"/>
                              </fields>
                              <rowactions>
                                 <action type="edit"/>
                                 <action type="delete"/>
                                 <action type="multi" label="Restore this Version" icon="sk-icon-upload" snippet="skuid.pageList.restoreVersion">
                                    <actions>
                                       <action type="updateRow" fieldmodel="__SelectedPage__" field="skuid__Layout__c" enclosevalueinquotes="true" value="{{{skuid__Layout__c}}}"/>
                                       <action type="updateRow" fieldmodel="__SelectedPage__" field="skuid__Layout2__c" enclosevalueinquotes="true" value="{{{skuid__Layout2__c}}}"/>
                                       <action type="updateRow" fieldmodel="__SelectedPage__" field="skuid__Layout3__c" enclosevalueinquotes="true" value="{{{skuid__Layout3__c}}}"/>
                                       <action type="updateRow" fieldmodel="__SelectedPage__" field="skuid__Layout4__c" enclosevalueinquotes="true" value="{{{skuid__Layout4__c}}}"/>
                                       <action type="updateRow" fieldmodel="__SelectedPage__" field="skuid__Layout5__c" enclosevalueinquotes="true" value="{{{skuid__Layout5__c}}}"/>
                                       <action type="blockUI" message="Restoring Page Version {{Name}}..."/>
                                       <action type="save">
                                          <onerroractions>
                                             <action type="blockUI" message="There was an error restoring this Page Version." timeout="1500"/>
                                          </onerroractions>
                                          <models>
                                             <model>__SelectedPage__</model>
                                          </models>
                                       </action>
                                       <action type="requeryModels" model="__SelectedPage__">
                                          <models>
                                             <model>__SelectedPage__</model>
                                             <model>__SelectedPageVersions__</model>
                                          </models>
                                       </action>
                                       <action type="blockUI" message="Page Version restored!" timeout="1000"/>
                                    </actions>
                                 </action>
                                 <action type="popup" label="Show XML" icon="sk-icon-popup">
                                    <popup width="80%" title="Viewing {{Model.label}}: {{Name}}">
                                       <components>
                                          <basicfieldeditor showheader="true" showsavecancel="false" model="__SelectedPageVersions__" buttonposition="" mode="readonly" layout="above">
                                             <columns>
                                                <column width="100%">
                                                   <sections>
                                                      <section title="XML" collapsible="no">
                                                         <fields>
                                                            <field type="COMBO" valuehalign="" editmodebehavior="autopopup" allowhtml="true">
                                                               <template>{{skuid__Layout__c}}
{{skuid__Layout2__c}}
{{skuid__Layout3__c}}
{{skuid__Layout4__c}}
{{skuid__Layout5__c}}</template>
                                                            </field>
                                                         </fields>
                                                      </section>
                                                   </sections>
                                                </column>
                                             </columns>
                                             <conditions>
                                                <condition type="contextrow" field="Id" mergefield="Id" autocreated="true"/>
                                             </conditions>
                                          </basicfieldeditor>
                                       </components>
                                    </popup>
                                 </action>
                              </rowactions>
                              <massactions usefirstitemasdefault="true">
                                 <action type="massupdate"/>
                                 <action type="massdelete"/>
                              </massactions>
                              <views>
                                 <view type="standard"/>
                              </views>
                              <actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true"/>
                              <filters>
                                 <filter type="toggle" filteroffoptionlabel="New Filter" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" label="Hide Auto Saves">
                                    <effects>
                                       <effect action="activate" value="" condition="IsNotAutoSave"/>
                                    </effects>
                                 </filter>
                              </filters>
                           </skootable>
                        </components>
                     </popup>
                  </action>
                  <action type="unblockUI"/>
               </actions>
            </action>
         </rowactions>
         <filters>
            <filter type="select" filteroffoptionlabel="Any Page Type" createfilteroffoption="false" affectcookies="true" condition="">
               <sources>
                  <source type="manual">
                     <options>
                        <option label="Any Page Type" type="complex">
                           <effects>
                              <effect action="deactivate" value="" condition="IsDesktopPage"/>
                              <effect action="deactivate" value="" condition="IsMobilePage"/>
                           </effects>
                        </option>
                        <option label="Desktop Pages" type="complex">
                           <effects>
                              <effect action="activate" value="" condition="IsDesktopPage"/>
                              <effect action="deactivate" value="" condition="IsMobilePage"/>
                           </effects>
                        </option>
                        <option label="Mobile Pages" type="complex">
                           <effects>
                              <effect action="activate" value="" condition="IsMobilePage"/>
                              <effect action="deactivate" value="" condition="IsDesktopPage"/>
                           </effects>
                        </option>
                     </options>
                  </source>
               </sources>
            </filter>
            <filter type="select" condition="PagesModule" filteroffoptionlabel="Any Module" createfilteroffoption="false">
               <sources>
                  <source type="manual">
                     <options>
                        <option label="Any Module" type="complex">
                           <effects>
                              <effect action="deactivate" value="" condition="PagesModule"/>
                              <effect action="deactivate" value="" condition="NoModule"/>
                           </effects>
                        </option>
                     </options>
                  </source>
                  <source type="metadata" prefix="Module: " suffix="" effectsbehavior="defaultandothers">
                     <effects>
                        <effect action="deactivate" value="" condition="NoModule"/>
                     </effects>
                  </source>
                  <source type="manual" effectsbehavior="justdefault">
                     <options>
                        <option label="No Module" type="complex">
                           <effects>
                              <effect action="activate" value="" condition="NoModule"/>
                              <effect action="deactivate" value="" condition="PagesModule"/>
                           </effects>
                        </option>
                     </options>
                  </source>
               </sources>
            </filter>
            <filter type="select" createfilteroffoption="true" filteroffoptionlabel="Select a Filter...">
               <sources>
                  <source type="manual">
                     <options>
                        <option label="Last Modified by Me" type="complex">
                           <effects>
                              <effect action="activate" value="" condition="LastModByMe"/>
                           </effects>
                        </option>
                        <option label="Last Modified by Me TODAY" type="complex" value="TODAY">
                           <effects>
                              <effect action="set" value="TODAY" condition="LastModDate"/>
                              <effect action="activate" value="" condition="LastModByMe"/>
                           </effects>
                        </option>
                        <option label="Last Modified by Me YESTERDAY" type="complex">
                           <effects>
                              <effect action="set" value="YESTERDAY" condition="LastModDate"/>
                              <effect action="activate" value="" condition="LastModByMe"/>
                           </effects>
                        </option>
                        <option label="Last Modified by Me THIS WEEK" type="complex">
                           <effects>
                              <effect action="set" value="THIS_WEEK" condition="LastModDate"/>
                              <effect action="activate" value="" condition="LastModByMe"/>
                           </effects>
                        </option>
                        <option label="Last Modified by Me IN LAST 7 DAYS" type="complex">
                           <effects>
                              <effect action="set" value="LAST_N_DAYS:7" condition="LastModDate"/>
                              <effect action="activate" value="" condition="LastModByMe"/>
                           </effects>
                        </option>
                        <option label="Created by Me" type="complex">
                           <effects>
                              <effect action="activate" value="" condition="CreatedByMe"/>
                           </effects>
                        </option>
                        <option label="Created by Me TODAY" type="complex">
                           <effects>
                              <effect action="set" value="TODAY" condition="CreatedDate"/>
                              <effect action="activate" value="" condition="CreatedByMe"/>
                           </effects>
                        </option>
                        <option label="Created by Me YESTERDAY" type="complex">
                           <effects>
                              <effect action="set" value="YESTERDAY" condition="CreatedDate"/>
                              <effect action="activate" value="" condition="CreatedByMe"/>
                           </effects>
                        </option>
                        <option label="Created by Me THIS WEEK" type="complex">
                           <effects>
                              <effect action="set" value="THIS_WEEK" condition="CreatedDate"/>
                              <effect action="activate" value="" condition="CreatedByMe"/>
                           </effects>
                        </option>
                        <option label="Created by Me LAST 7 DAYS" type="complex">
                           <effects>
                              <effect action="set" value="LAST_N_DAYS:7" condition="CreatedDate"/>
                              <effect action="activate" value="" condition="CreatedByMe"/>
                           </effects>
                        </option>
                     </options>
                  </source>
               </sources>
            </filter>
         </filters>
         <massactions defaultlabel="Mass Actions" defaulticon="" usefirstitemasdefault="true">
            <action type="massupdate">
               <hotkeys>
                  <hotkey modifiers="ctrl,shift" key="u"/>
                  <hotkey modifiers="meta,shift" key="u"/>
               </hotkeys>
            </action>
            <action type="massdelete">
               <hotkeys>
                  <hotkey modifiers="ctrl,shift" key="backspace"/>
                  <hotkey modifiers="meta,shift" key="backspace"/>
               </hotkeys>
            </action>
            <action type="popup" label="Build Page Pack" icon="sk-icon-page-package">
               <popup title="Build Page Pack" width="80%">
                  <components>
                     <pagetitle model="__StaticResourceInfoForPackaging__">
                        <maintitle>Create or Update a Skuid Page Pack</maintitle>
                        <actions>
                           <action type="custom" label="Build Page Pack" window="self" snippet="skuid.pageList.packagePages">
                              <hotkeys>
                                 <hotkey modifiers="" key="return" ignoretextinputs="true"/>
                              </hotkeys>
                           </action>
                        </actions>
                     </pagetitle>
                     <tabset rememberlastusertab="false" defertabrendering="true" renderas="radio" uniqueid="PagePackDetailsTabSet">
                        <tabs>
                           <tab name="Create New Pack" icon="sk-icon-add">
                              <components>
                                 <basicfieldeditor showheader="true" showsavecancel="false" model="__StaticResourceInfoForPackaging__" buttonposition="" mode="edit">
                                    <columns>
                                       <column width="100%">
                                          <sections>
                                             <section title="Details" collapsible="no">
                                                <fields>
                                                   <field id="Name"/>
                                                   <field id="Description"/>
                                                </fields>
                                             </section>
                                          </sections>
                                       </column>
                                    </columns>
                                 </basicfieldeditor>
                              </components>
                           </tab>
                           <tab name="Select Existing Pack" loadlazypanels="true" icon="sk-icon-edit">
                              <components>
                                 <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="5" createrecords="false" buttonposition="left" mode="readonly" model="PagesInStaticResources" searchplaceholdertext="Enter the name of a Pack..." emptysearchbehavior="remove">
                                    <fields>
                                       <field type="COMBO" allowhtml="true">
                                          <template>&lt;input type="radio" name="existingPagePack" value="{{{Id}}}"&gt;</template>
                                       </field>
                                       <field id="Name"/>
                                       <field id="NamespacePrefix" valuehalign="" type="" readonly="true">
                                          <label>Namespace</label>
                                       </field>
                                       <field id="BodyLength"/>
                                       <field id="Description"/>
                                       <field type="COMBO">
                                          <label>Last Modified</label>
                                          <template>{{LastModifiedById}} ({{LastModifiedDate}})</template>
                                       </field>
                                    </fields>
                                    <rowactions/>
                                    <massactions usefirstitemasdefault="true"/>
                                    <views>
                                       <view type="standard"/>
                                    </views>
                                    <searchfields/>
                                 </skootable>
                              </components>
                           </tab>
                        </tabs>
                     </tabset>
                  </components>
               </popup>
               <hotkeys/>
               <drawer title="Drawer Area" width="90%" closehandle="true">
                  <components/>
               </drawer>
            </action>
         </massactions>
      </skootable>
   </components>
   <labels/>
   <resources>
      <labels/>
      <javascript>
         <jsitem location="staticresource" name="SkuidBuildersJS" cachelocation="false" url="" namespace="skuid"/>
         <jsitem location="inline" name="PageListJSMax" cachelocation="false" url="">(function(skuid){

    //
    // Define extensions to Skuid Salesforce Rest Api wrapper,
	// the base of which is defined in CoreJS.
    // 
    var sfdc = skuid.sfdc,
        api = sfdc.api,
        $ = skuid.$,
        SObject = api.SObject,
        query = api.query,
        escapeMetadataBody = api.escapeMetadataBody,
        registerSnippet = skuid.snippet.registerSnippet;
    
    // Preview page
    registerSnippet('skuid.pageList.previewPage',function(){
        var params = arguments[0],
            pagePreview = skuid.snippet.getSnippet('skuid.builder.page.preview');
        pagePreview &amp;&amp; pagePreview({
            model: params.model,
            row: params.item ? params.item.row : params.row
        });
    });
    
    // BytesToKB
    registerSnippet('skuid.pageList.bytesToKBs',function(){
        var	field = arguments[0],
        	value = arguments[1],
        	displayValue = 0;
        
        if ($.isNumeric(value)) {
            displayValue = $.number(value / 1000,1) + ' KB';
        }
        
        skuid.ui.fieldRenderers.TEXT.read(field,displayValue);
    });
    
    // Multipicklist
    registerSnippet('Multipicklist',function(){
        skuid.ui.fieldRenderers.MULTIPICKLIST.edit(arguments[0],skuid.utils.decodeHTML(arguments[1]));
    });
    
    // This snippet packages a set of Skuid Pages into a StaticResource which we call a "Page Pack."
    // In addition to the standard snippet attributes, its "obj" argument contains the following:
    //		srName (required) - The Name of the Static Resource file to create/update 
    //		srDescription - The Description of the Static Resource file to create/update
    registerSnippet('skuid.page.packagePages', function(obj){
    	
    	var	srName = obj.srName,
    		srDescription = obj.srDescription,
    		srSOQL = 'SELECT Id, Name, Description FROM StaticResource WHERE Name = 
' + srName + '', pagesModel = skuid.model.getModel('pagedata'), pagesToPackage = [], pagesSOQL = 'SELECT Id, Name, skuid__Type__c, skuid__UniqueId__c, skuid__Module__c, ' + 'skuid__Layout__c, skuid__Layout2__c, skuid__Layout3__c, skuid__Layout4__c, skuid__Layout5__c ' + 'FROM skuid__Page__c ' + 'WHERE Id IN ('; // Collect the Ids of the Pages to be packaged and finish building the Page SOQL query string $.each(pagesModel.registeredItems,function() { if (this.selected) { pagesToPackage.push(this.row.Id); } }); // If no Pages were selected, display an error and stop packaging if (pagesToPackage.length === 0) { $.blockUI({ message: 'Please select at least one Page for your Page Pack', timeout: 2500 }); return; } pagesSOQL += pagesToPackage.join(',') + ') ORDER BY skuid__Module__c, Name'; $.blockUI({ message: 'Getting Page and StaticResource records...' }); // Query for the Static Resource file and the Pages data var srData, srQuery = query(srSOQL), pagesData, pagesQuery = query(pagesSOQL); $.when(pagesQuery).then(function(res){ pagesData = res.records; }); $.when(srQuery).then(function(res){ srData = res.records; }); $.when(srQuery,pagesQuery).then(function(){ var resource, ResourceCreationProcess = $.Deferred(); // If this resource already exists, set the Id for updating if (srData.length &gt; 0) { resource = new SObject('StaticResource',{ Id : srData[0].Id }); ResourceCreationProcess.resolve(); // If this resource does not already exists, create a new resource } else { $.blockUI({ message: 'Creating StaticResource...' }); resource = new SObject('StaticResource',{ Name : srName, Description : srDescription, Body : escapeMetadataBody(JSON.stringify([])) }); resource.insert({ success:function(){ ResourceCreationProcess.resolve(); }, error:function(jqXHR){ ResourceCreationProcess.reject({ resourceName: srName, errorMessage: jqXHR.responseJSON[0].message }); } }); } $.when(ResourceCreationProcess).then( // SUCCESS handler function(){ $.blockUI({message: 'Packaging Pages into StaticResource...', timeout: 500}); resource.Body = escapeMetadataBody(JSON.stringify(pagesData)); resource.ContentType = 'application/json'; $.when(resource.update()).then( // Success function(){ // Block the UI with a temporary message $.blockUI({ message: 'The "' + srName + '" Page Pack was created/updated successfully!', timeout: 3000 }); // Close the topmost popup $('.ui-dialog-content').last().dialog('close'); // Refresh our PagesInStaticResources Model skuid.$M('PagesInStaticResources').updateData(); }, // Failure function(failureObj){ // Un-block the UI $.blockUI({ message: 'There was an error creating the "' + srName + '" Page Pack' + ((failureObj &amp;&amp; failureObj.errorMessage) ? ':\n\n' + failureObj.errorMessage : '.'), timeout: 5000 }); } ); }, // FAILURE handler function(failureObj){ $.blockUI({ message: 'There was an error creating the "' + failureObj.resourceName + '" Page Pack:\n\n' + failureObj.errorMessage, timeout: 5000 }); } ); }); }); registerSnippet('skuid.page.packagePagesInModules',function(obj){ var model = obj.model, row = obj.row, modules = model.getFieldValue(row,'skuid__Module__c',true); if (!modules){ window.alert('Please select a Module.'); return; } $.blockUI({ message: 'Retrieving Page and StaticResource records...' }); var uniqueModules = modules.split(";"), moduleNamesString = "(" + uniqueModules.join(",") + ") ", moduleResourceNamesString = "('" + uniqueModules.join("Pages,") + "Pages) ", // Query for StaticResource files in these Modules, // and Query for Pages in these Modules. // When both queries are done, // move on resourceQuery = query( "select Id, Name from StaticResource where Name in " + moduleResourceNamesString ), pagesQuery = query( "select Id, Name, skuid__Type__c, skuid__UniqueId__c, skuid__Module__c, " + "skuid__Layout__c, skuid__Layout2__c, skuid__Layout3__c, skuid__Layout4__c, skuid__Layout5__c " + "from skuid__Page__c where skuid__Module__c in " + moduleNamesString + "order by skuid__Module__c, Name" ), pages, resources; $.when(pagesQuery).then(function(res){ pages = res.records; }); $.when(resourceQuery).then(function(res){ resources = res.records; }); $.when(resourceQuery,pagesQuery).then(function(){ $.blockUI({ message: 'Checking for Resources that may need to be created...' }); var resourceByModule = {}, resourcesToCreate = {}, pagesByModule = {}; $.each(resources,function(){ resourceByModule[this.Name.substring(0,this.Name.indexOf('Pages'))] = new SObject('StaticResource',{ Name: this.Name, Id: this.Id, // Put in a dummy body, since we're about to update it Body: this.Body }); }); $.each(pages,function(){ var resource = resourceByModule[this.skuid__Module__c], modulePages = pagesByModule[this.skuid__Module__c]; if (!resource) { resourcesToCreate[this.skuid__Module__c] = 1; } if (!modulePages) { modulePages = pagesByModule[this.skuid__Module__c] = []; } modulePages.push(this); }); var ResourceCreationProcess = $.Deferred(), outstandingJobs = {}; // Go create any needed StaticResources $.each(resourcesToCreate,function(moduleName){ var resourceName = moduleName+'Pages', resource = new SObject('StaticResource',{ Name: resourceName, // Put in a dummy body since we're about to modify it Body: escapeMetadataBody(JSON.stringify([])) }); resourceByModule[moduleName] = resource; outstandingJobs[resourceName]=1; // Create the Resource resource.insert({ success:function(){ delete outstandingJobs[resourceName]; if (skuid.utils.size(outstandingJobs)===0) { ResourceCreationProcess.resolve(); } }, error:function(jqXHR){ // If we get a blocking error, then reject our deferred, passing in the error thrown ResourceCreationProcess.reject({ resourceName: resourceName, errorMessage: jqXHR.responseJSON[0].message }); } }); }); if (skuid.utils.size(resourcesToCreate)===0) { ResourceCreationProcess.resolve(); } $.when(ResourceCreationProcess).then( // SUCCESS handler function(){ $.blockUI({message: 'Packaging Pages into StaticResources...', timeout: 500}); var ResourceUpdateProcess = $.Deferred(), numResourcesToUpdate = skuid.utils.size(pagesByModule); $.each(pagesByModule,function(module,pagesList){ var resource = resourceByModule[module]; if (resource){ resource.Body = escapeMetadataBody(JSON.stringify(pagesList)); resource.ContentType = 'application/json'; $.when(resource.update()).then(function(){ numResourcesToUpdate--; if (numResourcesToUpdate===0) { ResourceUpdateProcess.resolve(); } }); } }); $.when(ResourceUpdateProcess).then(function(){ var srNames = []; $.each(pagesByModule,function(m){ srNames.push(m+'Pages'); }); $.blockUI({ css: { 'text-align': 'left' }, message: 'Module Pages packaged successfully!&lt;br/&gt;&lt;br/&gt;The following StaticResources were updated, ' + 'or created if they did not exist before:&lt;br/&gt;&lt;ul&gt;&lt;li&gt;' + srNames.join('&lt;/li&gt;&lt;li&gt;') + '&lt;/ul&gt;' , timeout: 5000 }); }); }, // FAILURE handler function(failureObj){ $.blockUI({ message: 'There was an error creating the new StaticResource "' + failureObj.resourceName + '":\n\n' + failureObj.errorMessage, timeout: 7500 }); } ); }); }); // Package Pages registerSnippet('skuid.pageList.packagePages',function(){ var params = arguments[0], model = params.model, row = params.row, srDetails = { "srName" : model.getFieldValue(row,'Name'), "srDescription" : model.getFieldValue(row,'Description') }, tabs = $("input[name='tab-radio-PagePackDetailsTabSet']"); // Check to see if we are creating a new Page Pack or updating and existing one $.each(tabs,function() { var tab = $(this); // If we are updating an existing Page Pack, get the Name and Description if (tab.prop('checked') === true &amp;&amp; tab.val() === '1') { var existingModel = skuid.model.getModel('PagesInStaticResources'), existingRow = existingModel.getRowById($("input:radio:checked[name='existingPagePack']").val()); srDetails.srName = existingModel.getFieldValue(existingRow,'Name'); srDetails.srDescription = existingModel.getFieldValue(existingRow,'Description'); } }); // Call the packaging snippet var snippet = skuid.snippet.getSnippet('skuid.page.packagePages'); if (snippet) { snippet($.extend(params,srDetails)); } }); // Refresh Pages registerSnippet('skuid.pageList.refreshPages',function(){ var params = arguments[0], srList = [], pagePackSelect = $('#pageSRSelect').find('input'), res; $.each(pagePackSelect,function() { var input = $(this), srName = input.val(); if (srName !== null &amp;&amp; input.prop('checked') === true) { srList.push(srName); } }); if (srList.length &gt; 0) { skuid.$.blockUI({ message: 'Refreshing Pages in selected Static Resources...' }); skuid.PageListControllerExtension.RefreshPagesFromStaticResource(JSON.stringify(srList),function(result,event) { skuid.model.getModel('pagedata').updateData(function() { if (result &amp;&amp; result.isSuccess === true) { skuid.$.blockUI({ message: 'Success!', timeout: 1500 }); } else { var errMsg = 'There was an error refreshing one or more pages'; if (result &amp;&amp; result.errorList &amp;&amp; result.errorList.length &gt; 0) { errMsg += ':'; $.each(result.errorList,function(i,val) { errMsg += '&lt;br/&gt;\n&lt;br/&gt;\n' + (++i) + '. ' + val; }); } skuid.$.blockUI({ message: errMsg, timeout: 7500 }); } }); }); } }); })(skuid);</jsitem> </javascript> <css/> </resources> </skuidpage>
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
I'd say a snippet can be made to automate the process of cloning the version into it's own page. Don't have the time myself though.