Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

Custom field in process_record logic_hooks

I created a logic_hook process_record to do operations on listview of a custom module.
Within the file I need to work on custom fields of the bean in question, the problem is that I cannot access them.
Printing the bean, only the native fields appear, but not the “_c” fields.
Does anyone know why and how to solve it? Thanks

Okay, I got the reason.
process_record only allows access to the fields I show in the listview

That is correct. But you can make fields available even if you don’t show them, just make them query_only in the view defs.

Interesting, but I tried it and it doesn’t work.
I don’t know if this is the correct way: I entered

'usage' => 'query_only',

inside my custom field

in

custom/modules/<MODULE>/metadata/listviewdefs.php

I also did a Q&R and I keep seeing that field.
Am I doing something wrong?

I don’t know, I’ve only ever done this subpanels, not list views.

What is your complete field definition? Make sure to use only name and usage parameters, nothing else.

And check that the file is getting picked up by changing some label or width and checking that it takes effect.

This is the complete definition of my field, with the addition of usage:

'<CUSTOM_FIELD>' => 
  array (
    'type' => 'decimal',
    'default' => true,
    'label' => 'LBL_CUSTOM_FIELD',
    'width' => '10%',
    'usage' => 'query_only',
  ),
'<CUSTOM_FIELD>' => 
  array (
    'name' => '<CUSTOM_FIELD>',
    'usage' => 'query_only',
  ),

No, it doesn’t work. Maybe it is only good for subpanels and not for listviewdefs

Quite possible. I can’t find any example in the codebase with list views. Although the list views share most of the code with subpanels…

Did you check the file was getting picked up?

Yes, the file is uploaded