How to audit or control that a new item has been added to a subpanel?

I know that I can define a new field and make it Auditable with the “Audit” checkbox option, but I can’t find a way to have a register about when a new item is added to a subpanel.

Example:
1.- I have a custom module with a new relation One To Many with the Notes module
2.- I also have a Note created on 01/01/2020
3.- The new subpanel is enable in my custom module each time I’m in detail view design and I add the “This is my first note” to be part of the Project. This happend on 03/03/2020
4.- My workmates can see exactly when the Note was added and start doing some tasks

I would like that the subpanel of my custom module shows a line with the information
Title of the note AND date added to the supanel
In other words–> “This is my first note” AND 03/03/2020

Any easy way to do this? I’m trying with the columns properties (date_entered and date_modified) but both of us has 01/01/2020 and I want the date when the note was linked to my custom module subpanel.

It could be great solutions with no need of PHP editing :slight_smile:
Ideas?
Thank you very much! :smiley:

You can try with after_relationship_add hook, which will fire when a record is associated with the module.

Ahh thank so much @cherub-chum.

So after_relationship_add will be triggered when I add something in a subpanel, OK.
Then, I will need to follow these steps:

  1. Using Studio, create a new field in Notes module named “dateLinkedToCustomModule”
  2. Create a hook new after_relationship_add and stamp the current date as a the new value for “dateLinkedToCustomModule” field
  3. Show that field in the subpanel using studio

Anything else?

I have read that the action is triggered on both modules of the relationship. so I ask… Will SuiteCRM try to find a “dateLinkedToCustomModule” field in the CustomModule?? It has no sense for me… the date is a value that only the notes should have (the “MANY” side of the relationship) but not the CustomModule (the “ONE” side of the relationship.
So I’m not sure how to avoid errors or if I’m missing something as a rookie of SuiteCRM, hehehe :stuck_out_tongue:

Any help?
Thanks!

in your logic hook, you can print the $arguments to see which module and related module are involved and then build your logic. Put your hook in the notes module and check the above array

OK, I’ll try to work on it with this information.
Thank you so much @cherub-chum !! :slight_smile: