This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
en:devel:entityidentifier [2017/07/16 00:45] joebordes |
en:devel:entityidentifier [2020/04/25 16:45] (current) joebordes |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== How to change entity identifier ====== | ====== How to change entity identifier ====== | ||
- | Sometime we the default entity identifier field is not import for us and we want to change for other field that yes. | + | Sometimes, when the default entity identifier field is not significant for us and we want to change it for some other field that is more relevant. |
- | For example. In Opportunity module the default identifier is "Opportunity Name", but we want need the "Opportunity No". | + | For example. In Opportunity module the default identifier is "Opportunity Name", but we want may want to use the "Opportunity No". |
- | For this we have to create a scritp like the next. | + | |
- | <code> | + | For this, we have to create this script: |
- | <?php | + | |
+ | <code PHP> | ||
// Turn on debugging level | // Turn on debugging level | ||
$Vtiger_Utils_Log = true; | $Vtiger_Utils_Log = true; | ||
Line 18: | Line 17: | ||
$module = Vtiger_Module::getInstance('Potentials'); | $module = Vtiger_Module::getInstance('Potentials'); | ||
- | $module->unsetEntityIdentifier();//This unset the potentialname like a entity identifeir | + | $module->unsetEntityIdentifier(); // this unset the potentialname like a entity identifeir |
- | $field = VTiger_Field::getInstance('potential_no',$module); //Now you get the field that you want to entity identifier | + | $field = VTiger_Field::getInstance('potential_no', $module); // now you get the field that you want to entity identifier |
- | $module->setEntityIdentifier($field);//And finally you set this field. | + | $module->setEntityIdentifier($field); // set this field. |
- | + | ||
- | ?> | + | |
</code> | </code> | ||
- | and then modify the main class of the module. In the header change some references to the previous entity field, at least list_link_field. | + | and then modify the main class of the module. In the header change some references to the previous entity field, at least **list_link_field**. |