- Issue created by @marco aurelio rocca
- 🇩🇪Germany jurgenhaas Gottmadingen
Have you tried the Entity: set field value action?
There is the method "Set and enforce clear previous value" which may be working and you could try and leave the value empty.
Or there is the "Remove value instead of adding it" method where you could provide the current entity in value which should then be removed.
- 🇧🇷Brazil marco aurelio rocca
Hallo, Jurgen, yes I've tried those methods, "Set and enforce clear" too, leaving empty the "Field value" field, with no results. Also, that "Remove value instead" was tried in vain before I read it with more attention and noticed that it is intended for multi-value fields, which is not my case.
This ECA Model where I find such a problem has the "Updated Entity" trigger called 3 times. Could that interfere with anything relevant here? I'll upload the exported model, but it will refer to content types and fields specific to the project, hope it is not so bad.
- 🇧🇷Brazil marco aurelio rocca
Sending the model exported, as previously said, and a correction: the trigger is called 4 times...
- "field_atendente" here is an Entity Reference field, pointing to a User
- "field_statusdemanda" here is a Workflow Field, with Workflow module turned on (not Drupalcore's "Workflows", notice), where the workflow state of the node is set.
- "update entity" then is a trigger that tries to detect that a Node has had its workflow-state changed, and react to that in such a way that either a User is comissioned to "take care" of that node OR a User is unset at all, because no-one will take care of that node.
- attached image shows where the specific problem lies: when I try to UNSET the Reference to a User Entity
- 🇧🇷Brazil marco aurelio rocca
UPDATE:
- couldnt make the Entity Reference field turn EMPTY,
- letting empty the "field value" did no change it at all, while
- filling it with word "NULL" made it point at the ANONYMOUS user, which is the same as if I had made "field value = 0"
- even then, I DID manage to get it "pointing at nowhere", by forcing something monstrous like "field value = 111111111" (that is, a non-existent User entity)....
- ugly, isn't it? ^_^''
- any better idea?
- 🇩🇪Germany jurgenhaas Gottmadingen
I've tried that and can confirm, that an empty value for an entity reference field doesn't work.
However, what does work is to remove a value from an entity reference field. And if that's the only value, then the field will be empty afterwards. In the following screenshot we are removing the term with the ID 1 from the
field_tags
in a node. - 🇧🇷Brazil marco aurelio rocca
OK, THAT I did not try, really cool!
You fill "field value" with the very present value of the field, which you want to clear... is that correct?
I'll try that in my environment next monday and bring here the result!
Thank you very much!