<div dir="ltr">Hi all,<div><br></div><div>When I created a new record in my custom module I can initialize the fields with method: getCleanInstance</div><div><br></div><div>In the example bellow I initialized the filed [1] customnamefield with a default value.</div><div><br></div><div>The second field [2], for example account, is composed by id and display (select field),</div><div>in this case I don't understand how initialize the display value [2B].</div><div><br></div><div>-----------------------------------------------</div><div><div> public static function getCleanInstance($moduleName) {</div><div><br></div><div> $focus = CRMEntity::getInstance($moduleName);</div><div> $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);</div><div> $instance = new $modelClassName();</div><div> $recordModel = $instance->setData($focus->column_fields)->setModule($moduleName)->setEntity($focus);</div><div><br></div><div> // [1] Normal text input</div><div> $fieldName = "customnamefield";<br></div><div> $recordModel->set($fieldName, 'this is default value');</div><div><br></div><div> <br></div><div> //[2A] related field </div><div> $fieldName = "accountid";<br></div><div> $recordModel->setData($fieldName, '1'); </div><div><br></div><div> //[2B] related field display value - WRONG</div><div> $fieldName = "accountid_display";<br></div><div> $recordModel->setData($fieldName, 'Account name'); </div><div><br></div><div> </div><div> return $recordModel;</div><div> </div><div> }</div><div><br></div><div>Can someone help me how I can initialize different type of filelds ?<br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div style="font-size:small"><b><br>Enrico Manna</b></div><div style="font-size:small"><i>Web2e - Strategie per il web</i></div><div style="font-size:small"><br></div><div style="font-size:small">Web: <a href="http://www.web2e.it" style="color:rgb(17,85,204)" target="_blank">http://www.web2e.it</a></div><div style="font-size:small"><br></div><div style="font-size:small"><br></div><div><br></div></div></div>
</div></div>