[Vtigercrm-developers] HelpDesk - Relate to only accounts

Alan Lord alanslists at gmail.com
Tue Nov 13 00:54:50 PST 2012



On 13/11/12 03:33, Richard Hills wrote:
> Can anyone tell me how to remove the ability for a helpdesk ticket to be
> related to a contact?

Using vtlib, you can *unset* stuff too...

Below is an example of some of my vtlib creation code which tests for 
the existence of a field in my module, if it is there, removes it, then 
re-creates it... (I do this for all my vtlib stuff so I can re-run it 
again and again whilst developing.)

I'm pretty sure you could run this against the HelpDesk module to remove 
the 'Accounts' relation from the setRelatedModule call. (I haven't 
tested this BTW it's just a snippet from my normal code)

// Set the Contact/Account popup relation
$field_relate = Vtiger_Field::getInstance('parent_id', $module);
if ($field_relate != false) {
	$field_relate->unsetRelatedModules(Array('Contacts', 'Accounts'));
	$field_relate->delete();
}
$field_relate = new Vtiger_Field();
$field_relate->name = 'parent_id';
$field_relate->label= 'Related to';
$field_relate->column = 'parent_id';
$field_relate->columntype = 'INT(11)';
$field_relate->uitype = 10;
$field_relate->typeofdata = 'V~M';
$block_main->addField($field_relate);
$field_relate->setRelatedModules(Array('Contacts'));

Obviously I would try this on a dev system first ;-)

PS: I notice that the HelpDesk Related To field is a UI Type 68!!! I 
guess this must be a throw back to pre-vtlib days. Hmm, I'd still give 
the above a try and see what happens.

HTH

Al




More information about the vtigercrm-developers mailing list