Yetiforcecrm: [QUESTION] When updating one lead, are there some ways to send a request outside? API

Created on 10 Mar 2017  ยท  5Comments  ยท  Source: YetiForceCompany/YetiForceCRM

Issue

@nhieu92
I am loking for API in detail to use. But it has no references and this is quite difficult. Hope that the community could help.

  • YetiForce Version used: 4.0.0
โ” question

Most helpful comment

Hi @migoi . You are right. We want to connect YetiForce to other web. So, each time we change something on YetiForce, we want to make a callback, send a POST (or PUT) request to this site.

All 5 comments

from #4023

you want YetiForce to send (emit) a request on changing / adding a record via webgui?

Hi @migoi . You are right. We want to connect YetiForce to other web. So, each time we change something on YetiForce, we want to make a callback, send a POST (or PUT) request to this site.

Hi,

I think this is similar to something I too want to do. Basically I have created a custom module, and it has a check box which when clicked (and the record is saved) I want it to post the data from my custom module to my website. Is this something that can be done using the Api?

No one can't help :)

The answer you seek is creating a workflow that executes whenever there's a lead update operation and after that you have to write a custom function here's an example function for you

Register the custom function to the crm

include_once 'include/main/WebUI.php';
require 'modules/com_vtiger_workflow/VTEntityMethodManager.php';
$emm = new VTEntityMethodManager(PearDatabase::getInstance()); 

//uncomment this line to enable custom function for Documents
$emm->addEntityMethod('Leads', 'Sms notification for Sales Department', 'include/LeadSmsHandler.php', 'SmsNotification');

from there create a file 'include/LeadSmsHandler.php' put all your logic in this file.

  function SmsNotification($entity) {

    global $current_user, $adb, $log;

    \App\Log::trace("Entering Lead SmsNotification Workflow Function: send sms from (".$entity->get('moduleName').")...");
    \App\Log::trace("Trigerring Potential is: ".$entity->get('id').".");

    include_once 'include/utils/CommonUtils.php';
    include_once 'include/database/PearDatabase.php';
    include_once 'modules/SMSNotifier/providers/ImagineIPS.php';

    $assigned_to = $entity->data['assigned_user_id'];

Please take note function naming it must correspond with function registerd.

Lemme know

Was this page helpful?
0 / 5 - 0 ratings