0

I added an entity reference field to user referring to a type book.

I also created a rule that each time e user update that field, selecting one book, his role changes from authenticated to reader. So let's suppose there's a book and five users pointing to that book. These five users are readers. What i would like to do is that when that book is deleted, those 5 users role change into authenticated, being no more readers.

What i need is a way to reach the referencing users when deleting a book. I think adding multiple reference field from book to users could be kinda dirty, because there's already a connection between book and reader.

I've already created a rule that when a user change his book field, selecting no book, his role reader is revoked. I hoped that in this way, considering that when i delete a book all the users referencing to that book change automatically their referencies, their role can change too, but unfortunately it seems that this is not considered a "After updating an existing user account" condition.

How could i do that possibly using rules? If it is possible, but not via rules, can you explain me in details how can i do?

1 Answer 1

0

I think i resolved it by using "fetch entity by property" and looking for the entity reference field that is equal to the current removed book. Doing that create a list that you can iterate with the loop and inside this use actions to revoke roles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.