Ok so I have having some issues, I think everything is right here but for some reason it wont hit the URL with my query parameters when I Edit a lead and the press the save button. Can you let me know what is wrong here?
The pushDataToBirdEyeMethod I know works because it was coded out and tested by a dev before me. But for some reason I cannot even get that to fire when i press the save button editing a lead. The second method there pushDataToLEDZap I coded out and just copied pushDataToBirdEyeMethod. None of them fire when the lead is edited and saved. Am I thinking of this wrong or something? Or is it before_save supposed to fire somewhere else? I am new to SuiteCRM so confused here. Please help!
Here is my workflowdataforzapier.php
<?php
class workflowdataforzapier{
public function pushDataToBirdEyeMethod($bean,$event,$argument){
$url = "https://hooks.zapier.com/hooks/catch/5317863/oz9p9h0?first_name=$bean->first_name&last_name=$bean->last_name&email=$bean->email1&phone=$bean->phone_home&status=$bean->status";
ob_start();
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_URL, $url);
curl_setopt($curl_request, CURLOPT_FRESH_CONNECT, true);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl_request);
if($response->status == "success"){
$bean->pushed_data_to_birdeye_c = 1;
}
}
public function pushDataToLEDZap($bean,$event,$argument){
$url = "https://hooks.zapier.com/hooks/catch/5317863/oz0ic42?first_name=$bean->first_name&last_name=$bean->last_name&email=$bean->email1&phone=$bean->phone_home&status=$bean->status&lead_type=$bean->initial_lead_type_c&id=$bean->id";
ob_start();
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_URL, $url);
curl_setopt($curl_request, CURLOPT_FRESH_CONNECT, true);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl_request);
}
}
Here is my logic_hooks.php under /custom/modules/Leads/logic_hooks.php
<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(77, 'send data to BirdEye', 'custom/modules/Leads/workflowdataforzapier.php','workflowdataforzapier', 'pushDataToBirdEyeMethod');
$hook_array['before_save'][] = Array(78, 'send data to FreeLED', 'custom/modules/Leads/workflowdataforzapier.php','workflowdataforzapier', 'pushDataToLEDZap');
?>
So I even removed the send data to FreeLED from the logic_hooks file and had like the previous developer coded when he tested and got it to hit the URL with the Query strings. For some reason i cannot or am probably not even editing it properly or what not for it to be firing. Please advise!
EDIT: Are my file locations wrong or something? Just reading thru docs and still cant figure this one out.
logic_hooks.php file is located at /custom/modules/Leads/logic_hooks.php
workflowdataforzapier.php file is located at /custom/modules/Leads/workflowdataforzapier.php