Hooks provide an additional feature i.e. we can add custom code functionality to SuiteCRM. There are many types of hooks available in suiteCRM.
process_record is one of the module logic hook which has very amazing functionality…Let’s see how.
According to the Definition,
“Fired when a record is processed ready to be displayed in list views or dashlets.”
Basically process_record is the only logic hook executes when the record is being processed as a part of the ListView or subpanel list. Consider as example, in list view of Account Module We want to append “Acc_” to eavery record name field value. But we dont want to store this in the database. Every time when account module will load, each name field value will be prefixed with “Acc_”.
Click Here to see the detailed example with code snippet.
Another example of process_record hook is, consider in the list view of the Leeds module, we want to distinguish the Leads based on the status. e.g. if the lead is in open state then it should be highlighted with green color. If it is in processing then it should be “yellow”. So this type of visual effect can be given using process_record hook.
Hello - great article, I have noticed that if a custom field is hidden on the list view (i.e. the “Choose columns”) then, the custom field value is not available in the bean. If I add the field to the list view, then I can get the value of that field with the bean.
Do you know if there is a way to get the value of a custom field to work with on the bean without having to show it on the list view? For example, if you are wanting to color a field that IS shown on the list view but it is based on a field calculation from a custom field that is hidden from the list view. Hope this question makes sense!
Google for SuiteCRM examples containing the expression “query_only”
That’s is a way to reference a field in the view defs without showing it in the UI, just so it can be used somewhere else. It basically ensures that the field gets loaded, which I think is what you’re asking for.
In your example could you do something like: if (lets say lead status) = new then
"<div style="color:red;">.$bean->status."</div>";
if status = contacted "<div style="color:green;">.$bean->status."</div>";
I guess what I’m asking is the function like a while loop that goes through the records one by one and appends/prepends each record or does it have to apply to all records in the list?