[Vtigercrm-developers] Writing a function and using it in a custom module

Asha asha at vtiger.com
Thu Mar 17 13:01:35 PDT 2011


Hi Darlington Mpofu,

Please see my comments inline:

> 1. where do l write the function, in the module.js or in the module.php or
> either


If the function is to perform action on client side, then you write it in
module.js. If the function is to perform action or do some computation on
the server side, then you write it in module.php. Some times you may have to
write function in module.js to trigger an action/function from module.php
file as a way to interact from client end.

>
> 2.how do l capture values from custom fields in a function


You can call retrieve_entity_info on a CRMEntity instance to get the values
of all the fields and fetch them from the object. (You can also query them
directly from database if required).

>
> 3.how do l place the values into fields after querying the tables


Have a look at retrieve_entity_info function of data/CRMEntity.php file

>
> 4. is it the right thing to call the function inside the save_module
> function in the module.php file


It all depends on what your function does. If it performs a action that is
part of save, then it makes sense to have it in place.

-- 
Regards,
Asha
vtiger Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20110318/7c63a836/attachment-0002.html 


More information about the vtigercrm-developers mailing list