[Vtigercrm-developers] Function vtws_revise creates an incorrect history entry

MrJingles paddy at renaissancegroup.co.uk
Mon Jun 6 14:51:24 GMT 2016


Hi,

I'm fairly new to vTiger but have developed a very handy CRM which our
organisation is very happy with.

I'm in the process of implementing a number of custom functions and I'm
learning as I go and need some assistance if possible.

I'm looking at utilising the *vtws_revise* function to update a particular
field. I'm testing this function at the moment and my code is pasted at the
end of this post.

The problem I encounter is twofold:

1. If my Workflow is configured to run my Custom Function every time a
record is saved, it enters a permanent loop continually trying to update the
field and then requires me to restart Apache to stop the loop.

2. If my Workflow is configured to run my custom function whenever a
particular field(lastname) is changed then the function works. However, the
updates only shows the custom field (testfield) being updated and it shows
it twice. e.g. testfield was changed to 'Testing was Here' 1 second ago, and
then again testfield was changed to 'Testing was Here' 1 second ago.

I am fairly new to being a developer so am unsure if it is an issue in my
code or something I've missed.

Any help would be greatly appreciated!!

Thanks, Paddy


*My Custom Function Code is Below*
<?php

function Testing($entity){

require_once('include/Webservices/Utils.php');
require_once('include/Webservices/Revise.php');
require_once("modules/Users/Users.php");

	global $current_user, $adb, $log;

	$entityarray = get_object_vars($entity);

	$moduleName = $entity->moduleName;
	$leadid = $entity->id;
	$fielddatatoupdate = 'Testing Was Here';

	$log->debug("Entering Custom Workflow Function: Update Field for
(".$moduleName.")...");
	$log->info("Trigerring for Lead ID: ".$leadid.".");

	$parameters = array( 
	'cf_780' => $fielddatatoupdate,
	'id' => $leadid
	);

	$infoparameters = print_r($parameters, true);

	$log->info("Updating field for: ".$infoparameters."...");
	
	$toupdate = vtws_revise($parameters, $current_user);

	$log->debug("Custom Workflow - Exiting the Update Field Function...");

}

?>




--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Function-vtws-revise-creates-an-incorrect-history-entry-tp19167.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.


More information about the vtigercrm-developers mailing list