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

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.

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”.

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:

{{Model.label}}







{{#$Param.id}}{{Name}}{{/$Param.id}}{{^$Param.id}}New Master Item{{/$Param.id}}










Again, all these buttons wind up using /{{Model.KeyPrefix}}/o.

I updgraded to skuid version 4.15.14 and am getting the same behavior as before.

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.
 

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 :slight_smile: 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="<a target="_blank" rel="nofollow" href="http://google.com&quot;/>">http://google.com"/></a>;
            <action type="savecancel" window="blank" afterSave="<a target="_blank" rel="nofollow" href="http://skuidify.com&quot;">http://skuidify.com"</a>; afterCancel="<a target="_blank" rel="nofollow" href="http://cnn.com&quot;">http://cnn.com"</a>; 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="<a target="_blank" rel="nofollow" href="http://espn.com&quot;/>">http://espn.com"/></a>;
            <action type="savecancel" window="blank" afterSave="<a target="_blank" rel="nofollow" href="http://msn.com&quot;">http://msn.com"</a>; afterCancel="<a target="_blank" rel="nofollow" href="http://salesforce.com&quot;">http://salesforce.com"</a>; saveLabel="Save (MSN)" cancelLabel="Cancel (salesforce)"/>
         </actions>
      </pagetitle>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>