[Vtigercrm-developers] UITYPES and Translation files

Sukhdev Mohan s.mohan at myti.it
Tue Mar 15 09:34:35 GMT 2022


I was missing the default value and setPicklistValues. I’ll try this out maybe the version we use has bugs...

Sukhdev Mohan
Developer
On 15 Mar 2022, 10:29 +0100, Alan Lord <alanslists at gmail.com>, wrote:
> 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
>
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220315/1ce020e6/attachment-0001.html>


More information about the vtigercrm-developers mailing list