BPM - Use custom variables that will be calculated and replaced before the email is sent

Hi guys,

before go deeper in the code and do it maybe not the best way, I want to know if one of you face my problem and maybe solved it.

I want to send an email using the BPM from my record A (for instance an Opportunity).

In this email, I would like to list all the records linked in the subpanel B (for instance all the Contacts of an Opportunity).

Out of the box, I can't do this.

My idea was to define some custom variables available for specific modules (for instance ###ContactsList###).

During the BPM send email action, I will check if custom variables are defined, and replace them with the corresponding value (with custom code).

Any idea ? better solution ? or trick about how to do this ?

Many thanks,

Fred