- Issue created by @tetatu
- π©πͺGermany jurgenhaas Gottmadingen
If you run cron on a Drupal site, the PHP process executes in the context of an anonymous user. And those don't have the permission to change entity field, normally. That's why you get an access denied message. You can use the switch user action to escalate privileges of your ECA model.
But I gave Admin 1 permissions at the beginning of the process.
In the original post, I included the model and the SVG image of the model, so you can see that I did it this way and gave permission.https://ecaguide.org/plugins/eca/user/actions/eca_switch_account/
- π©πͺGermany jurgenhaas Gottmadingen
In the "Entity: set field value" action you didn't specify for which entity you want to set the field value.
Solved.
So, if it is "Event: Cron", "Action: Entity Load", then "Entity: set field value", then when setting "Action: Entity Load", the following fields cannot be left blank, but the field token must be entered in both: "Name of token" and in the "Entity" field.- π©πͺGermany jurgenhaas Gottmadingen
The event cron doesn't automatically provide any tokens.
When you use the action "Load entity", you store the loaded entity in a token.
Then, when using the "Set field value" action, you need to use the token name that holds your entity in the entity field.
That's pretty much exactly what the description in the config forms tells as well. And there is a full chapter about tokens in the ECA Guide.
I browsed the https://ecaguide.org/ page a lot, but I didn't always find a detailed description that would have helped, but it's probably enough for a more experienced Drupal developer. What is required in the configuration form is not always clear. Obviously, you have to get used to it after the Rules module, where the module already provided the values ββto be set in a drop-down list, but in ECA you have to enter them manually and the form of entering tokens and more, it's a bit confusing.
I'll go through the section about Tokens in the description again.
Thank you!