Page 1 of 1

Update vtiger field through Dispo Call URL

PostPosted: Wed Mar 05, 2014 12:17 pm
by eroennig
I am trying use the "Dispo Call URL" function to automatically update the status of a vtiger lead. However, I seem to need some help :) Has anyone set this up already and could give me a quick step-by-step tutorial on how to do this?

Thanks

Re: Update vtiger field through Dispo Call URL

PostPosted: Tue Apr 01, 2014 9:41 pm
by williamconley
dispo call url is not a function, it's a php script. there should be an example (or two) in the agc folder.

In fact, have a look at:
/usr/src/astguiclient/trunk/www/agc/dispo_move_list.php

Re: Update vtiger field through Dispo Call URL

PostPosted: Tue May 20, 2014 4:02 pm
by TroyD
This is what Im playing with to update Sugarcrm. Although I have a seperate table for phones, you can easily get the idea and modify. Also you should put some if ispost statements in there to handle things better. I am assuming here that I will always have a vaild post.. There is a better way to do this Im sure of it, but at least it will get you going down the path to updating CRM upon dispositions.. (Currently I am not getting a value posted for the security_phrase field but hope to resolve this soon)

This is for writing to MSSQL with php 5.3 You will have to use other methods for writing to db if you use mysql.. Google is your friend.. Basically change sqlsrv to mysql or mssql for pdo extensions..

(Hosting this on IIS by the way, you can host on apache if you like)

*******************Begin PHP Code **************
<?php

//Set Debug options overriding the PHP settings temporarily
ini_set('display_errors', 1);
error_reporting(E_ALL);

//Define SQL server connection
$serverName = "192.111.000.123";
$connectionInfo = array( "Database"=>"NEWCRM", "UID"=>"admin", "PWD"=>"yourpasswd" );
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}

//Get status from dialer and store in variable
$phoneid = $_GET["security_phrase"];
$dial_status = $_GET["dispo"];

// Deal with the time and date and set into variable
date_default_timezone_set("UTC");
$timestamp = date("Y-m-d H:i:s", time());
// echo "$timestamp";

//Query to update CRM with posted data from dialer
$sql = "UPDATE phone_phones SET dial_status = '".$dial_status."', last_called_time = '".$timestamp."', dialer_call_attempts = dialer_call_attempts +1 Where id = '".$phoneid."'";

// If we have addl paramaters use this
//$params = array(1, "some data");

// Run the query if any errors then die.
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}


// Close the SQL connection.
sqlsrv_close( $conn);


// Log posted variables for debugging
file_put_contents( "dialogger.txt", print_r($_REQUEST, true));

?>

*********************** END PHP Code *******************

Re: Update vtiger field through Dispo Call URL

PostPosted: Tue May 20, 2014 5:39 pm
by mav2287
We also use Vtiger on one of our installs. We have been using 6.0.0 which is pretty, but not as functional. We pull up leads with the following.

Code: Select all
<iframe src="http://XXX.XXX.XXX.XXX/vtigercrm/index.php?module=Leads&view=Detail&record=--A--vendor_lead_code--B--" style="background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame"  width="--A--script_width--B--" height="--A--script_height--B--" STYLE="z-index:17"> </iframe>


We sync the lead ids to a custom field with the following mysql query
Code: Select all
 update vtiger_leadscf set cf_739 = leadid;


This way we can just do a normal export for vtiger and then drop that into vicidial. Then we dial on it and it pops the leads. The way we do notes is similar to the script already posted above.

Re: Update vtiger field through Dispo Call URL

PostPosted: Mon Jul 07, 2014 11:57 pm
by williamconley
That would be something to ask on a PHP and/or MySQL forum. Here, we would suggest you open the aforementioned php file and modify it to suit your needs. It's fairly easy for any php/mysql tech who is familiar with Vicidial and vTiger ... but still should not present a problem for anyone who is ONLY familiar with php/MySQL. But bringing you up to speed on two languages here in this post is a bit outside ... Especially since you lead with "hey, show me how to do something vague". Like ... teach me how to drive (instead of teach me how to start a car, mom gave me the key).