How To: Hide Form Tasks

You can make use of the custom task functionality to hide tasks from everyone or just end users. Inside your custom task you can add a new function to be bound to the forms onReady event. Simply set your custom function as the argument for the following method:

formObj.boundReady(); 

In the case of hiding a task we are just going to use a function that uses jQuery to select the task element and hide it:

$( ".taskmenu li:contains('Assign To Me')" ).hide() 

Where 'Assign To Me' is the case sensitive string of the task. With the out of the box styles, css is used to force all characters to lower case, so you may need to inspect the string to get the proper case. So if you want to hide a task from everyone:

app.custom.formTasks.add('ServiceRequest', null, function (formObj, viewModel) { formObj.boundReady(function () { $( ".taskmenu li:contains('Assign To Me')" ).hide() }); }); 

To only hide a task for end users just wrap the jQuery select and hide method in a if statement based on session.user.Analyst being false

app.custom.formTasks.add('Incident', null, function (formObj, viewModel) { formObj.boundReady(function () { if (!session.user.Analyst) { $( ".taskmenu li:contains('Assign To Me')" ).hide() } }); });