Hi all,
I need to show the sum of some fields taken from another module in a field in the current module.
It is not a problem to query and find the value but which logic hook is recommended for this?
It would be advisable to update the field at each listview ⌠can I use after_retrieve?
I see there are contraindications.
In order to prevent loop, does it make sense to use this hook to update the db directly instead of trying to save the field?
Thank you for your answer.
Ok, I would have preferred to save in the db but I need this calculation to be done on listview or detailview. So Iâll choose process_record.
But a practical question:
Can I use something like $id = $ bean-> id
to retrieve the fields and suite executes this hook for each line?
@2di7
The hook âprocess_recordâ called for each record of a module separately.
Can I suggest an option? You can decide your task if you will use special parametr âfunctionâ for a filed. As an example:
I make the field âage_yearsâ. The field is calculating the age of contact.
The file - custom/Extension/modules/Contacts/Ext/Vardefs/age_years.php:
Hi @TerryL !
No need to create a field in the studio. (I didnât write about it)
Creating a field in the studio takes precedence over manual creation. Item 2 of your post creates the field manually.
I recommend:
I did think that was the case, which I had tried previously. Anyway, I removed the field in Studio and QRR twice, but I get the same result⌠nothing.
Am I missing something here?
I donât understand where the field would appear on the âdetail Viewâ layout.? If the field does not appear in the fields list in Studio, how do I place it where I want it to be on the layout.?
Ok, so I did exactly as you said in your last post. It didnât work. So I started again and did exactly as you said - it still does not work in SCRM-8.
I assume I do still need to enter the metadata details for field âage_yearsâ in custom/modules/Contacts/metadata/detailviewdefs.php as per my earlier post (step5). If I donât do this I get no field at all on Contacts Detail viewâŚ
SO at this stage this is what I have on the Contact Detail View;
As you can see, no age is calculated. Interestingly, when I go to âEdit Viewâ the field is also shown even though the editview metadata was not altered.
To know this earlier would have saved me many many hours, but perhaps you did not know either.
It seems to me that SuiteCRM 8 has many many shortfalls. Everything I try to implement ends with a roadblock. I now wish I had started with SuiteCRM 7.