How can i make a rule that search for the same content for the same field.

Example: User 1 and user 2 fills both the same form/node.
User 1:
Field A: XXX
Field B: YYY

User 2:
Field A: XXX
Field B: ZZZ

I want a warning that says that XXX already exists.

Comments

mitchell’s picture

Title: search for the same fieldcontent » Action: load content by arbitrary field
Component: Rules Core » Rules Engine
Status: Active » Postponed

My buddy coded an action just like this, which I think would allow for that. ie: when content is going to be saved, load content by arbitrary field with entered value, if content loaded successfully, don't save the node and show an error. It wasn't 100% reliable and kinda hackish, so please don't hold your breath for some amazing, bug free code. I hope to get it posted though, even if it doesn't get committed.

mitchell’s picture

Title: Action: load content by arbitrary field » Action: load content by arbitrary field
Version: 6.x-1.2 » 7.x-2.x-dev
Status: Postponed » Active

I think EFQ supports this. In general, it would be nice to have some query builder interface for operations like, starts with, ends with, and other data manipulations.

Disregard #1.

tr’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes
Status: Active » Closed (won't fix)

Won't do this in D7 at this point in time. If there's interest in doing this in D8/D9 please open a new issue and provide a patch.