Accessing datafields in javascript(when sending a mail)

Hello.
I am working with a mail, where I have “tilbud” as a list of different “tilbud” in function params. In this mail I want to list the names of companies that the “tilbud” has been sent to, but the field returns as undefined. Here’s the code:

I can access tilbud.leverandor, meaning it prints the ID of it, but tilbud.leverandor.navn does not work.

Is there any workarounds for this?

Hi,

And happy new year!

You cannot access deep properties when adding whole datasources as function params. See the «Good to know» section here:

Ok so if I understood right I just add a runtime property on Tilbud of datatype String, and use a function:

return leverandor.navn

using the self property leverandor.
This didn’t work at least, so I ended up just iterating through all companies and if the ID matched tilbud.leverandor, I returned selskap.navn. Not very efficient, but works for now.

Thanks for the help, happy new year:)