Retrieving two field from custom modules and concatenating

Hello,

I am attempting to name each record which is created within a module automatically using an ID which can be found in a different custom module.

I have three modules, lets call them:

  1. Module A
  2. Module B
  3. Module C

Module C has a relate field to both Module A and Module B and both of these modules have an id field called id_field_c

When a record is created in module C the name field should be populated the a concatonation of id_field_c from the related Module A and Module B.

Can anyone assist with this? If my explanation doesn’t make sense please let me know.

One way of doing it is in a before_save logic hook