[Vtigercrm-developers] UITYPES and Translation files
Alan Lord
alanslists at gmail.com
Tue Mar 15 09:23:58 GMT 2022
On 15/03/2022 08:58, Sukhdev Mohan wrote:
> Thanks Alan, you're always a very good point for resources!
>
> I recently had to create a uitype 16 (non based picklist) through vtlib,
> it seemingly created the field but when I tried to add values from admin
> menu it resulted in error. Checking the DB there were some tables
> missing and even if I added them manually the field didn't work. Had to
> create a custom picklist from layout and that worked. Something for
> uitype 15. So the question is what's the right procedure?
This works for me:
> $module = Vtiger_Module::getInstance('LSSvcPNW');
> $block_svcd = Vtiger_Block::getInstance('Satellite', $module);
> $table = 'ls_svcs_pnw'; > $picklist_array = array("New Service", "Upgrade", "Downgrade",
"Reactivation", "Suspension", "Termination");
> $field = new Vtiger_Field();
> $field->name = 'lssvc_svctype';
> $field->column = $field->name;
> $field->label = 'Service Type';
> $field->table = $table;
> $field->columntype = 'VARCHAR(255)';
> $field->uitype = 15;
> $field->typeofdata = 'V~O';
> $field->defaultvalue = 'New Service';
> $field->summaryfield = 1;
> $block_svcd->addField($field);
> $field->setPicklistValues($picklist_array);
> unset($field, $picklist_array);
Some field values are optional obviously.
HTH
Al
More information about the vtigercrm-developers
mailing list