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

edited October 2017 in Questions
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?
skuid.snippet.registerSnippet('tasks.markCompleted',function(params){     console.log('test');     // 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.');         return;     }     $j.each(selectedItems,function(i,item){         model.updateRow(item.row,'Status','Completed');     });     // Block the list from having updates     list.element.block({         css: list.blockUICSS, overlayCSS: list.blockOverlayCSS,         message:'Marking Tasks as Completed...'     });     var saveFinishes ={callback:         function(){             var updateFinishes = skuid.model.updateData([model,skuid.model.getModel('TaskHistory')]);             $j.when(updateFinishes).then(                 function(){ list.element.unblock(); },                 function(){ list.element.unblock(); }             );         }     }); 


  • edited October 2017
    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.


Sign In or Register to comment.