Redirect URLs don't work independently for multiple Buttons of the same Action Type

  • 3
  • Problem
  • Updated 4 years ago
  • Acknowledged
As an example I have a skuid Page with two Page Titles in it.  Each has a Button of Save / Cancel Action Type.  Top to bottom on the page the first Button pair has an After Save Redirect URL of /{{Model.KeyPrefix}}/o.  The second button pair has an After Save Redirect URL of /{{Id}}.  The behavior of either Save button in this case results in the use of /{{Id}}.  If I reverse the Page Title order on the Page, the result of either Save button results in the use of /{{Model.KeyPrefix}}/o.

My particular requirement is to have both pairs of buttons have the same Redirect URLs so that the Button pairs behave in unison.  This works fine in skuid but I discovered the above behavior while configuring my requirement.  They really ought to work independently.
Photo of Rusty Shakleford

Rusty Shakleford

  • 114 Points 100 badge 2x thumb

Posted 4 years ago

  • 3
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Hi Rusty, thanks for reporting this --- what version of Skuid are you using? I have tried to replicate this and in every case, for me, the "initiating" button "wins".
Photo of Rusty Shakleford

Rusty Shakleford

  • 114 Points 100 badge 2x thumb
Hi hi Zach.  I am running skuid version number 4.15.4 and have reverified that the second button "wins" for me.  Neither should win though.  Here are the couple of snippets from my page:

<pagetitle model="MasterItem" cssclass="evoo-mustbevalid" uniqueid="">         <subtitle>{{Model.label}}</subtitle>
         <actions>
            <action type="redirect" label="View" window="self" url="/{{Id}}" icon="ui-silk-application-form-magnify" cssclass="evoo-hideonnew"/>
            <action type="savecancel" window="self" afterSave="/{{Id}}" afterCancel="/{{Id}}">
               <renderconditions/>
            </action>
         </actions>
         <renderconditions/>
         <maintitle>{{#$Param.id}}{{Name}}{{/$Param.id}}{{^$Param.id}}New Master Item{{/$Param.id}}</maintitle>
      </pagetitle>


<pagetitle model="MasterItem" cssclass="evoo-mustbevalid" uniqueid="">         <subtitle/>
         <actions>
            <action type="redirect" label="View" window="self" url="/{{Id}}" icon="ui-silk-application-form-magnify" cssclass="evoo-hideonnew"/>
            <action type="savecancel" window="self" afterSave="/{{Model.KeyPrefix}}/o" afterCancel="/{{Model.KeyPrefix}}/o">
               <renderconditions/>
            </action>
         </actions>
         <renderconditions/>
         <maintitle/>
      </pagetitle>

Again, all these buttons wind up using /{{Model.KeyPrefix}}/o.
Photo of Rusty Shakleford

Rusty Shakleford

  • 114 Points 100 badge 2x thumb
I updgraded to skuid version 4.15.14 and am getting the same behavior as before.
Photo of Brandon Klapholz

Brandon Klapholz

  • 390 Points 250 badge 2x thumb
I've also experienced the same issue as decided to create custom buttons the native Salesforce way (Setup --> "Object" --> Buttons and Links) and those custom in Skuid.

This worked for me, and I called it a day a moved on since I was pressed for time and unsure if I was doing something wrong, or if this was actually a  bug.
 
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb
Hey Zach -

Below is a page that reproduces the issue.  It appears that it is only encountered on the "cancel" button as the other buttons on this page all appear to behave as they should.

The problem appears to be with the event listeners on the cancel button as when clicking either cancel button, the action is taken twice - once for the top button and once for the bottom button. 

The page below is configured to redirect to "Blank window" for all buttons.  When clicking either Cancel button, I get a new tab for CNN and a new window for salesforce.  Make sure you allow popups when you attempt to repro :)  If you click either save button, the only thing that happens is a new tab for either Skuidify.com or msn.com depending on which save button you pressed.

<skuidpage showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
         </fields>
         <conditions>
            <condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
         </conditions>
      </model>
   </models>
   <components>
      <pagetitle model="Account">
         <maintitle>
            <template>{{Name}}</template>
         </maintitle>
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions>
            <action type="redirect" label="Google" window="blank" icon="ui-silk-application-go" url="http://google.com"/>;
            <action type="savecancel" window="blank" afterSave="http://skuidify.com"; afterCancel="http://cnn.com"; saveLabel="Save (Skuid)" cancelLabel="Cancel (CNN)"/>
         </actions>
      </pagetitle>
      <basicfieldeditor showheader="true" showsavecancel="false" model="Account" buttonposition="" mode="read">
         <columns>
            <column width="100%">
               <sections>
                  <section title="Section A">
                     <fields>
                        <field id="Name"/>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
      <pagetitle model="Account">
         <maintitle>
            <template>{{Name}}</template>
         </maintitle>
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions>
            <action type="redirect" label="ESPN" window="blank" icon="ui-silk-application-go" url="http://espn.com"/>;
            <action type="savecancel" window="blank" afterSave="http://msn.com"; afterCancel="http://salesforce.com"; saveLabel="Save (MSN)" cancelLabel="Cancel (salesforce)"/>
         </actions>
      </pagetitle>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>