<div dir="ltr">Thanks for the tip, i forgot about the version number!<div><br></div><div>I've wondered about the same thing, but so far it seems like the field doesn't get created on update at all.</div><div>I'm starting to wonder if it's even possible to create the field on a update event... :/</div><div><br></div><div>So far i've had no luck in creating the field on update, i'm almost 100% sure that i'm doing the field creation right, because it does work on a fresh install of the module.</div><div><br></div><div>Really hope someone knows the answer to this.</div><div><br></div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Kind regards,</div><div><br></div><div>-</div><div><br></div><div>Lennart </div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-01 17:10 GMT+01:00 Tim Mohrbach <span dir="ltr"><<a href="mailto:preexo@googlemail.com" target="_blank">preexo@googlemail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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><br><div>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><br></div><div><br><div><blockquote type="cite"><div><div class="h5"><div>On 01.02.2016, at 22:32, Lennart van Ballegoij <<a href="mailto:lennart@egmmedia.nl" target="_blank">lennart@egmmedia.nl</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">Hi guys,<div><br></div><div>I'm working on a VTiger 6.4.0 Extenstion Module that sends the invoicedata to a 3rd party API.</div><div>I'm trying to create a picklist field in the Invoice module from within my module.</div><div><br></div><div>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><br></div><div>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><br></div><div>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><br></div><div>Why can't i seem to create the field on the update events of the vtlib_handler ?</div><div><br></div><div>My code:</div><div><br></div><div><div>        public function vtlib_handler($moduleName, $eventType) {</div><div>                if ($eventType == 'module.postinstall') {</div><div>                        $this->createConfigTable();</div><div>                        $this->registerInvoiceEvent();</div><div>                        $this->addSettingsMenu();</div><div>                        $this->addTypeDropdown();</div><div>                } else if ($eventType == 'module.enabled') {</div><div>                        $this->registerInvoiceEvent();</div><div>                } else if ($eventType == 'module.disabled') {</div><div>                        $this->deregisterInvoiceEvent($moduleName);</div><div>                } else if($event_type == 'module.preupdate') {</div><div>                        $this->addSettingsMenu();                        </div><div>                } else if($event_type == 'module.postupdate') {</div><div><span style="white-space:pre-wrap">                 </span>$this->addTypeDropdown(); //Trying to create my Picklist field here !</div><div><span style="white-space:pre-wrap">         </span>} else if($event_type == 'module.preuninstall') {</div><div>                        $this->deleteConfigTable();</div><div>                        $this->deregisterInvoiceEvent($moduleName);</div><div>                }</div><div>        }</div></div><div><br></div><div><div>        public function addTypeDropdown(){</div><div><br></div><div>            $module = Vtiger_Module::getInstance('Invoice');</div><div>            $blockInstance = Vtiger_Block::getInstance('LBL_INVOICE_INFORMATION', $module);</div><div><br></div><div>            $fieldInstance = new Vtiger_Field();</div><div>            $fieldInstance->name = 'typeofinvoice';</div><div>            $fieldInstance->label = 'Soort factuur';</div><div>            $fieldInstance->table = 'vtiger_invoice';</div><div>            $fieldInstance->column = $fieldInstance->name;</div><div>            $fieldInstance->columntype = 'VARCHAR(100)';</div><div>            $fieldInstance->uitype = 15; //15 Staat voor dropdown.</div><div>            $fieldInstance->typeofdata = 'V~M';</div><div>            $fieldInstance->summaryfield = 1; //Display in summaryview.</div><div>            $fieldInstance->setPicklistValues( Array ('Factuur', 'Creditfactuur') );</div><div>            $blockInstance->addField($fieldInstance);</div><div>        }</div></div><div><br></div><div><br></div><div><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">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">Thanks in advance :)<br><br></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">Lennart</p></div><div><br></div></div></div></div>
_______________________________________________<br><a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>