<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I would have done it the same way, remember to increase the version number of the extension in the schema xml file… sry mate I am bad help…<div class=""><br class=""><div class="">I have always wondered about this: does it try to create a new field everytime it updates the extension or is the addField method tolerant enough to ingore the field in case it’s already there?</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 01.02.2016, at 22:32, Lennart van Ballegoij <<a href="mailto:lennart@egmmedia.nl" class="">lennart@egmmedia.nl</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi guys,<div class=""><br class=""></div><div class="">I'm working on a VTiger 6.4.0 Extenstion Module that sends the invoicedata to a 3rd party API.</div><div class="">I'm trying to create a picklist field in the Invoice module from within my module.</div><div class=""><br class=""></div><div class="">My module was already released and some clients are already using this module, so i'll have to create the field on the module update.</div><div class=""><br class=""></div><div class="">But i can't seem to add the picklist field on module.preupdate or module.postupdate of the vtlib_handler in my module.</div><div class=""><br class=""></div><div class="">If i uninstall/remove my module completely and add the picklist field using the module.postinstall of the vtlib_handler it does seem to create the field like it's supposed to.</div><div class=""><br class=""></div><div class="">Why can't i seem to create the field on the update events of the vtlib_handler ?</div><div class=""><br class=""></div><div class="">My code:</div><div class=""><br class=""></div><div class=""><div class="">        public function vtlib_handler($moduleName, $eventType) {</div><div class="">                if ($eventType == 'module.postinstall') {</div><div class="">                        $this->createConfigTable();</div><div class="">                        $this->registerInvoiceEvent();</div><div class="">                        $this->addSettingsMenu();</div><div class="">                        $this->addTypeDropdown();</div><div class="">                } else if ($eventType == 'module.enabled') {</div><div class="">                        $this->registerInvoiceEvent();</div><div class="">                } else if ($eventType == 'module.disabled') {</div><div class="">                        $this->deregisterInvoiceEvent($moduleName);</div><div class="">                } else if($event_type == 'module.preupdate') {</div><div class="">                        $this->addSettingsMenu();                        </div><div class="">                } else if($event_type == 'module.postupdate') {</div><div class=""><span class="" style="white-space:pre">                       </span>$this->addTypeDropdown(); //Trying to create my Picklist field here !</div><div class=""><span class="" style="white-space:pre">                </span>} else if($event_type == 'module.preuninstall') {</div><div class="">                        $this->deleteConfigTable();</div><div class="">                        $this->deregisterInvoiceEvent($moduleName);</div><div class="">                }</div><div class="">        }</div></div><div class=""><br class=""></div><div class=""><div class="">        public function addTypeDropdown(){</div><div class=""><br class=""></div><div class="">            $module = Vtiger_Module::getInstance('Invoice');</div><div class="">            $blockInstance = Vtiger_Block::getInstance('LBL_INVOICE_INFORMATION', $module);</div><div class=""><br class=""></div><div class="">            $fieldInstance = new Vtiger_Field();</div><div class="">            $fieldInstance->name = 'typeofinvoice';</div><div class="">            $fieldInstance->label = 'Soort factuur';</div><div class="">            $fieldInstance->table = 'vtiger_invoice';</div><div class="">            $fieldInstance->column = $fieldInstance->name;</div><div class="">            $fieldInstance->columntype = 'VARCHAR(100)';</div><div class="">            $fieldInstance->uitype = 15; //15 Staat voor dropdown.</div><div class="">            $fieldInstance->typeofdata = 'V~M';</div><div class="">            $fieldInstance->summaryfield = 1; //Display in summaryview.</div><div class="">            $fieldInstance->setPicklistValues( Array ('Factuur', 'Creditfactuur') );</div><div class="">            $blockInstance->addField($fieldInstance);</div><div class="">        }</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px" class="">Hopefully someone can give me a push in the right direction.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px" class="">Thanks in advance :)<br class=""><br class=""></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px" class="">Lennart</p></div><div class=""><br class=""></div></div>
_______________________________________________<br class=""><a href="http://www.vtiger.com/" class="">http://www.vtiger.com/</a></div></blockquote></div><br class=""></div></div></body></html>