Capture id of reference field

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ x] Documentation issue or request

Current behavior

Expected behavior

Minimal reproduction of the problem

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [x ] Cloud version

Version: [VERSION]

Browser:

  • [x ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:
Hi Sebastian
I have a reference schema (countries) which is referred in another schema (employee).
I don’t set the Id field in Countries schema, so it takes the event.id.
Now in the Employee, as I am referring countries, I need to capture the id of countries too
(Kafka rules)
I can’t seem to figure out how to get the countries id in the Employee kafka rule.
I tried few things like:
In Employee rules…
{% reference ‘Countries’, event.data.Countries.iv[0] %}
“Countries”: “{{Countries.id}}” – doesn’t see to work. It comes null.
“CountriesName”: “{{Countries.data.Name}}” - - this works fine and returns countries name

I can’t see to figure out as why id doesn’t work.
Thanks in advance.

There is no question here. Can I delete it?

Sorry took me a while to write the question

Hi, I don’t understand why

{{Countries.id}}

does not work. It could be a bug and I will have a look,

BUT you already have the id with

event.data.Countries.iv[0]

Why do you even resolve the reference?

Hi Sebastian

I could actually get value from event.data.Countries.iv[0].
The mistake I made was by taking it as reference, and then using id.

Its working now. Pls if you can close the ticket.

Thanks for your help !

1 Like