Jump to content
  • 0
DesiLogi

Bulk Edit Redirect on Update

Question

Hi, 

I have a tabular datapage that I'm using Bulk Edit to update selected records. When the 'Update' button is clicked I need to redirect to another url (using some parameters passed). I've tried a number of methods but can't seem to get it to work. 

- tried a custom 'update' button in an html block but it doesn't actually update the selected records (perhaps this is because and 'Update' on a Bulk Edit isn't the same as on a Details page?)

- tried to modify, in Localization, the Bulk Edit text with html code for the redirect url but it just shows the html markup in the button. Not sure if there's a way to do this there but it seems like it'd be cleanest if so. 

Any help would be greatly appreciated- 

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 1

In case anyone needs a solution on this.

1) create a tabular datapage that uses as a filter the field you will be updating (so that when that field is updated in Bulk Edit those records will be filtered out of the results upon refresh)

2) use js to auto-select all and open Bulk Edit on load of tabular datapage: 

    In header to reference jquery:

     

<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>

 

   In the footer: 

<script>
 
$(document).ready(function(){
 
setTimeout(function() {
var checkboxes = $("input[type='checkbox']");

for (i = 0; i < checkboxes.length; i++ ) {
  $(checkboxes[i]).prop('checked', true);
}

$("[data-cb-name='BulkEditButton']").click();

}, 10);
 
});
</script>

 

3) change the localization so that msg "no records found" is the redirect url you need. 

When the user opens the results page all records will be selected and Bulk Edit will open. They click Update (you need to configure what will be updated) and then all those records will be updated and the page's filter will therefore filter them out, causing the 'no records found' msg to kick in, and therefore your redirect url for that message. 

 

It's a bit of a workaround and only works if all records are to be selected but it's something. 

Share this post


Link to post
Share on other sites
  • 1

Hello,

Yes, I encountered the same issue when the last caspio update rolled. I have not began to troubleshoot the script but will give an update when I do.

Share this post


Link to post
Share on other sites
  • 1

The last CB update broke the code I was using for this. Apparently, (document).ready doesn't work anymore.  This is the code Caspio recommended to use now. It will select all records in the results and automatically open the Bulk Edit form.

<script>
document.addEventListener('DataPageReady', function (event) {
  if (event.detail.appKey == 'c2104000906ceabdc5f14cef8726') {
    setTimeout( function() {
      $( '#ToBulkDelete > input[type="checkbox"]' ).click();
      $("[data-cb-name='BulkEditButton']").click();
    }, 10 );
  }
});
</script>

 

Share this post


Link to post
Share on other sites
  • 0

I know answers that just say, 'I don't think you can do that' aren't very helpful, but I suppose it's better than leaving you hanging.

 

I have also tried to figure out how to do this with no luck - so I just give the user a message / link in the HTML that this DataPage is embedded in

Share this post


Link to post
Share on other sites
  • 0

Thanks for the answer anyway. The link/msg in the host page are the last resort but it's very clunky to do so. 

I almost found a way to do this- if the datapage filters out records that have been updated with what the Bulk Edit is to update, and user does a 'select all' for the Bulk Edit, you can put script into the localization for 'no records found' that redirects to another page after the Bulk Edit update (because the page refreshes and the updated records are filtered out). This works well. The only problem is if the user doesn't 'select all' so some records are left on the datapage. Then there's no explanation giving, no redirection.

I actually want to use 'select all' and this would work- except I can't figure out how to force the user to 'select all' records (without relying on a msg, which no one ever pays attention to). If I could have the datapage open with all records selected automatically- that would also solve the problem. If anyone knows how to do that please post- thanks.

Share this post


Link to post
Share on other sites
  • 0

I am looking to have the bulk update button automatically click after checkboxes click, is there a way to achieve this? Basically I want to open the datapage via windows task manager and automatically generate the bulk emails.

Share this post


Link to post
Share on other sites
  • 0

Hi. 

 

I've been using this script which was working perfectly through last week. Currently, it selects the checkboxes but now fails to select the bulk edit link. I'm not sure how to update the script to open the link. Any assistance would be appreciated. 

 

Thanks. 

Bre

Share this post


Link to post
Share on other sites
  • 0

Hi Carlson, 

Thanks so much for the feedback. The update seems to have affected some of my scripts and my delete triggers. Grateful that you will be sharing your troubleshooting results  with the community. 

Many Thanks!

 

Bre

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×