0
votes

I am using vtiger 6 and i would like implement a custom task for my workflow.

let me give more clues.

when you create new workflow in vtiger crm there are 3 step ahead.

1.first, you choose your module and a name for workflow

2.second, you define a condition

3.third (the important one in this issue), you create tasks for your workflow.for example when defined condition is fulfilled then send an sms to a user.

there are some available tasks such as send mail , send sms , create todo and etc.

i would like to implement one of these tasks. because of the poor documentation of vtiger crm i could not understand whats going on behind the scene and i would really appreciate any help.

3

3 Answers

1
votes

Vtiger Provides Option to Invoke Custom Function which you have to define as per your requirement.

You can follow this steps to create a Custom Workflow function.

STEP1: create one new file (RegisterWorkflow.php) to register workflow in your vtiger root directory.

require_once 'include/utils/utils.php';
require 'modules/com_vtiger_workflow/VTEntityMethodManager.inc';
$emm = new VTEntityMethodManager($adb);
//$emm->addEntityMethod("Module Name","Label", "Path to file" , "Method Name" );
$emm->addEntityMethod("Leads", "Update Lead", "modules/Leads/UpdateLead.php", "update_lead_data");

STEP2: run that file like.

http://YOUR_VTIGER_URL/registerworkflow.php

Note: you must run this file at once. If u run that file more than one time it will create Duplicate entry.

STEP 3: Go to modules/Leads/UpdateLead.php and Create one Function

function update_lead_data($entity){
    // Your Code here
}

Note : You can include Files which requires to execute you task

STEP 4: Create Workflow > Select Module for which you defined Custom Function > In step 3 Select Invoke Customer Function > Select Function Name which you Defined > Save

1
votes

I will try to explain the behind the scenes part(from what I have understood :) ):

    1. for cron workflows cron/vtigercron.sh is the star point this gets the handler file(cron/modules/com_vtiger_workflow/com_vtiger_workflow.service) for cron from db and executes it.

    2. cron/modules/com_vtiger_workflow/com_vtiger_workflow.service It fetches ready tasks from db and calls doTask on them(executes them)

    3. modules/com_vtiger_workflow/VTTaskQueue.inc This file fetches ready tasks from db(table com_vtiger_workflowtask_queue)

    4. You will find task types in com_vtiger_workflow_tasktypes table. It has handler files for respective tasks which has the doTask method mentioned earlier.

hope this helps.

0
votes

If you want to send SMS from CRM then you should do SMS configuration.

  • Go to Settings Icon VtigerSettingsIcon.png > Module Manager. This can be found under 'Studio' block.

  • Click on Settings Icon SettingsIcon.png next to SMS notifier.

  • Click on the link Server Configuration.

Please follow the steps of configuration as described in SMSNotifier

For sending emails from vTiger you have to configure Outgoing server. Once it will be setup then its straight forward to set email workflow.