Skip to content

Convert Lead with field of uitype == 77 failed.

When I convert a lead to an opportunity with a uitype == 77 the field is decleared as "reference" in vtiger_ws_fieldtype. In SaveConvertLead.php any references will converted with vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), fieldValue). But in case of an user ID the right function to create the webservice ID for the user ID is vtws_getWebserviceEntityId(vtws_getOwnerType(fieldValue), $fieldValue).

My solution in SaveConvertLead.php - Line 63:

} elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
	if($fieldModel->get('uitype') == 77){
		$fieldValue = vtws_getWebserviceEntityId(vtws_getOwnerType($fieldValue), $fieldValue);
	} else {
		$ids = vtws_getIdComponents($fieldValue);
		if (count($ids) === 1) {
			$fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
		}
	}
}