This is an old revision of the document!


How to add a workflow task with configuration screen

  • Add new task to valid task array, like this:
    diff --git a/modules/com_vtiger_workflow/VTTaskManager.inc b/modules/com_vtiger_workflow/VTTaskManager.inc
    index cd24b7f..cbdcddd 100644
    --- a/modules/com_vtiger_workflow/VTTaskManager.inc
    +++ b/modules/com_vtiger_workflow/VTTaskManager.inc
    @@ -115,7 +115,7 @@
     		
     		
     		function getTaskTypes($moduleName=''){
    -			$taskTypes = array("VTEmailTask", "VTEntityMethodTask", "VTCreateTodoTask","VTCreateEventTask","VTUpdateFieldsTask","VTCreateEntityTask");
    +			$taskTypes = array("VTEmailTask", "VTEntityMethodTask", "VTCreateTodoTask","VTCreateEventTask","VTUpdateFieldsTask","VTCreateEntityTask",'VTTagTask');
     			// Make SMSTask available if module is active
     			// TODO Generic way of handling this could be helpful
     			if(getTabid('SMSNotifier') && vtlib_isModuleActive('SMSNotifier')) {
  • Add new task file: modules/com_vtiger_workflow/tasks/VTTagTask.inc, which contains the class that will do the work.
  • The script modules/com_vtiger_workflow/tasks/VTTagTask.inc defines the base VTTask class extended for this case.
    • The name of the class has to be the same we added to the array in the first step
    • Important is the getFieldNames() method where simply adding a list of names they will get saved with no other work than to send them through REQUEST
    • The doTask() method is where the action of the task has to be implemented
  • Add translation strings for the new Task in com_vtiger_workflow
    'VTTagTask' => 'Add/Delete Tag',
  • Add new task template file: Smarty/templates/com_vtiger_workflow/taskforms/VTTagTask.tpl
    • This template file can do any magic that is needed, usually using the module's base translation files for screen output. Special considerations are that we have available a $task object with the definitions of the task we are editing and this object has properties for each of the variables we defined in the getFieldNames() method.
    • We simply have to create an HTML input or similar with the same name for it to be saved automatically

coreBOS Documentación