The CreatorCon Call for Content is officially open! Get started here.

Restrict adding/deleting of checklist item?

JennyHu
Tera Guru

Hello community,

Does anyone know if it's possible to not allow users to add additional checklist item or remove an existing checklist item?

I have a Business Rule to load a checklist from template after a record is created, and expect the users to work with the items from the template.   I would like to turn off the ability for users to add additional check list items or remove an existing item.   Is this possible?

Screen Shot 2017-07-18 at 12.31.12 PM.png

Thanks,

Jenny

10 REPLIES 10

michael_baker
Tera Guru

Hi Jenny,



I am not aware of functionality to lock down this functionality; however, you could create an onLoad Client Script for these records that removes the functionality from the form.   Something like the below might work.



var domMenu = document.getElementsByClassName('icon-contain-menu');   // Checklist menu


var domAdd = document.getElementsByClassName('add-item');   // Add Item Row


var domHandle = document.getElementsByClassName('handle-contain');   // Reorder Icon


var domIcon = document.getElementsByClassName('icon-contain');   // Delete Icon



removeDom(domMenu);


removeDom(domAdd);


removeDom(domHandle);


removeDom(domIcon);



function removeDom(elemArray) {


  while(elemArray.length > 0) {


      elemArray[0].parentNode.removeChild(elemArray[0]);


  }


}



Hope this helps!


Hi Michael,



Thanks for your reply.   I tried the onLoad Client Script code you have provided, and the document object returns null.   Is there a way to refer to a checklist formatter on a form using g_form?



Thanks,


Jenny


Hi Jenny,



Unfortunately I am not aware of any methods to access the checklist through the g_form.



Regards,


Mike


Hi Jenny,



I worked on an onLoad script that should wait for the checklist to render before removing the functionality.   Let me know if this works for you.



function onLoad() {


  var domChecklistItems = document.getElementsByClassName('handle-contain');


  setTimeout(function waitChecklistItems() {


      if (document.body.contains(domChecklistItems[0])) {


          var domMenu = document.getElementsByClassName('icon-contain-menu');   // Checklist menu


          var domAdd = document.getElementsByClassName('add-item');   // Add Item Row


          var domHandle = document.getElementsByClassName('handle-contain');   // Reorder Icon


          var domIcon = document.getElementsByClassName('icon-contain');   // Delete Icon



          removeDom(domMenu);


          removeDom(domAdd);


          removeDom(domHandle);


          removeDom(domIcon);


      } else {


          setTimeout(waitChecklistItems, 10);


      }


  }, 10);



  function removeDom(elemArray) {


      while(elemArray.length > 0) {


          elemArray[0].parentNode.removeChild(elemArray[0]);


      }


  }


}