Bulk Edit from GUI

Hi!

I'm currently trying to enable our users to conduct bulk editing on our app. Ideally we would love for our users to be able to select multiple products from the product table with the UI and then hit a "modify products" button where they would be able to edit a few elements of the products selected. An example would be a person selects products A and B and is able to change their owners from "Alpha" and "Beta" to just "Omega".

I have tried 2 different attempts with the GUI mode but still having trouble. First attempt was 'Bulk Update via Primary Key" and the issue there was I have to define each element specifically in order to edit. The other attempt I tried was the traditional, "Update an Existing Record" and the issue there was that it only updated one product despite multiple being selected. We had also enabled this query to edit multiple rows but it did not work. Any advice on this would be greatly appreciated!

Thank you!

Write data to SQL databases

@mayraSanchez Welcome to the forum!
Can you share more information?
Screen shots and code along with use case specifics will help the forum help you!

hi!

I believe I was able to figure out how to do the bulk edits that I was trying to do.

The current path for users to bulk edit is as follows:

  1. Select several products from the table
    multipleItemsSelected

  2. Select a new button that only appears when several products are selected.
    image

  3. Edit desired fields of the product.

  4. Hit Submit and then the following JS Transformer will run that generates the list required for bulk editing via primary key.

let productList = []; //creates an empty list

//getting the new selections
let bProductOwner = bulkEditForm.data.product_owner;
let bCISquad = bulkEditForm.data.ci_team_squad;
let bProductDomain = bulkEditForm.data.product_domain;

//assembling the array for the variables that were selected
for (let i = 0; i < ciProductTable.selectedRows.length; i++) {
  const row = ciProductTable.selectedRows[i];
  
  // Create a new object
  const formattedObject = {
    id: row.id,
  };

  // Add product_owner if it's defined
  if (bProductOwner) {
    formattedObject.product_owner = bProductOwner;
  }

  // Add ci_team_squad if it's defined
  if (bCISquad) {
    formattedObject.ci_team_squad = bCISquad;
  }

  // Add product_domain if it's defined
  if (bProductDomain) {
    formattedObject.product_domain = bProductDomain;
  }

  // Push the formatted object to the productList array
  productList.push(formattedObject);
}

// Now, productList contains the desired format for each selected row
console.log(productList);

//exports the productList
return productList

  1. Bulk Edit Query runs and makes the desired changes

What do y'all think of this approach? Would love to hear back from experts!