Can I change this code for use with a custom object?

  • 1
  • Question
  • Updated 2 years ago
  • Answered
This code is for marking Tasks as complete. I don't know much JS. I want to replace the standard object Tasks with a custom object. I thought I would only have to change the Status, Complete and then make sure the model was correct. 

Any advice?
   // Mark all selected items as closed,
   // then save our 2 Tasks models
   var model = params.model,
       list = params.list,
       selectedItems = params.item ? [params.item] : list.getSelectedItems();
   if (selectedItems.length === 1 && skuid.model.isNewId(selectedItems[0].row.Id)) {
       alert('Please finish creating this Task before marking it as completed.');
   // Block the list from having updates
       css: list.blockUICSS, overlayCSS: list.blockOverlayCSS,
       message:'Marking Tasks as Completed...'
   var saveFinishes ={callback:
           var updateFinishes = skuid.model.updateData([model,skuid.model.getModel('TaskHistory')]);
               function(){ list.element.unblock(); },
               function(){ list.element.unblock(); }
Photo of Sara M

Sara M

  • 90 Points 75 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 13,612 Points 10k badge 2x thumb
Sara M,

This snippet is setup to mark selected tasks in a table completed.  If your goal is to mark selected rows (any object) as 'completed', I would recommend that you setup a Mass Action on the table.  You can use Skuid action steps to update any fields and save the changes for each record that was selected.