- Issue created by @gmak
- 🇩🇪Germany jurgenhaas Gottmadingen
What you're looking for are tokens. And you got to it towards the end of your issue description: the token
[node:field_status:entity:name]
in e.g. indeed giving you the name of the referenced entity, if the fieldfield_status
is an entity reference field and if the tokennode
is available in the context where you're using that token.You can read more about Tokens in the ECA Guide.
To do a comparison, you could e.g. use this condition: Compare two scalar values
The first value could be your token
[node:field_status:entity:name]
and the second value could be the fixed name that you're looking for. - 🇬🇧United Kingdom gmak
Hi Jurgen,
Thank you for the help. It is working! I can now check that value of the taxonomy term. I hadn't tried the 'compare 2 scalar values'.
I hope you might be able to help with the next step.
If the value of the taxonomy term [node:field_status:entity:name] = 'X', I need to change the value of another taxonomy. How can I do this by passing a text value, say "New", to the taxonomy field [node:field_status_2] and have it update the node.
The difficulty I am seeing is that the entity reference field [node:field_status_2] wants to be passed a taxonomy ID (tid) and not a text string.
Is there a way to set a reference field value based on the string? (This would be like selecting the value from the select list in a form)
Many thanks
- 🇩🇪Germany jurgenhaas Gottmadingen
The linked chapter about tokens in the ECA guide has an info block "Read-only vs. read-write tokens". The token like the one we used for comparison is read-only.
If you want to change a field value in an entity, you have to load that entity (see https://ecaguide.org/plugins/eca/content/actions/eca_token_load_entity), then set one of its fields (see https://ecaguide.org/plugins/eca/content/actions/eca_set_field_value/) and then Dave that entity again.
The library in the ECA guide has a lot of examples that are doing things like that. A lot of them also link to videos where you can watch how they got created.