Is there an easy way to save a new pageversion for all pages in a module?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Are we allowed to create a skuid page on the Pages object?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
And the answer is yes!



I've hard-coded the "name" of the page version (which is actually the skuid__Description__c), but you could throw a ui-only text field at the top and use that to set the description if you'd like.

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true" tabtooverride="skuid__Page__c">   <models>
      <model id="skuidPage" limit="100" query="true" createrowifnonefound="false" sobject="skuid__Page__c" adapter="" type="">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
            <field id="CreatedById"/>
            <field id="CreatedBy.Name"/>
            <field id="LastModifiedDate"/>
            <field id="skuid__UniqueId__c"/>
            <field id="skuid__Type__c"/>
            <field id="skuid__Page_Versions__r" type="childRelationship" limit="3" orderby="CreatedDate DESC">
               <fields>
                  <field id="skuid__Description__c"/>
               </fields>
               <conditions/>
            </field>
            <field id="Id"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
      <model id="skuidPageVersion" limit="" query="false" createrowifnonefound="false" adapter="" type="" sobject="skuid__Page_Version__c">
         <fields>
            <field id="skuid__Page__c"/>
            <field id="skuid__Page__r.Name"/>
            <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="skuid__Description__c"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" value="false" enclosevalueinquotes="false" field="skuid__IsAutoSave__c"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="skuidPage" uniqueid="sk-Q1P7M-70">
         <maintitle>
            <template>{{Model.labelPlural}}</template>
         </maintitle>
         <subtitle>
            <template>Home</template>
         </subtitle>
         <actions>
            <action type="savecancel"/>
         </actions>
      </pagetitle>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="skuidPage" mode="read" uniqueid="sk-Q1P7M-71">
         <fields>
            <field id="Name" valuehalign="" type=""/>
            <field id="CreatedDate" allowordering="true" valuehalign="" type=""/>
            <field id="LastModifiedDate" valuehalign="" type=""/>
            <field id="skuid__Page_Versions__r" type="CHILDREL" limit="100" valuehalign="" delimiter="&lt;br&gt;" readonly="true">
               <label>Page Versions</label>
               <template>{{skuid__Description__c}}</template>
            </field>
         </fields>
         <rowactions>
            <action type="edit"/>
            <action type="delete"/>
         </rowactions>
         <massactions usefirstitemasdefault="true">
            <action type="massupdate"/>
            <action type="massdelete"/>
            <action type="multi" label="Create New PageVersion" icon="sk-icon-magic">
               <actions>
                  <action type="createRow" model="skuidPageVersion" appendorprepend="prepend" defaultmodefornewitems="edit">
                     <defaults>
                        <default type="fieldvalue" field="skuid__Page__c" enclosevalueinquotes="true" value="{{Id}}"/>
                        <default type="fieldvalue" field="skuid__Description__c" enclosevalueinquotes="true" value="Optimize 1.0"/>
                        <default type="fieldvalue" field="skuid__Layout__c" enclosevalueinquotes="true" value="{{skuid__Layout__c}}"/>
                        <default type="fieldvalue" field="skuid__Layout2__c" enclosevalueinquotes="true" value="{{skuid__Layout2__c}}"/>
                        <default type="fieldvalue" field="skuid__Layout3__c" enclosevalueinquotes="true" value="{{skuid__Layout3__c}}"/>
                        <default type="fieldvalue" field="skuid__Layout4__c" enclosevalueinquotes="true" value="{{skuid__Layout4__c}}"/>
                        <default type="fieldvalue" field="skuid__Layout5__c" enclosevalueinquotes="true" value="{{skuid__Layout5__c}}"/>
                     </defaults>
                  </action>
                  <action type="save">
                     <models>
                        <model>skuidPageVersion</model>
                     </models>
                  </action>
                  <action type="requeryModel" model="skuidPage" behavior="standard"/>
               </actions>
            </action>
         </massactions>
         <views>
            <view type="standard"/>
         </views>
      </skootable>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
   <styles>
      <styleitem type="background" bgtype="none"/>
   </styles>
</skuidpage>
(Edited)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
WOOT!