I have an open facing form that a visitor can fill out to request information. I add that visitor to the sites contacts. Is there a way to query the sites contacts to see if that visitor has already made a request so I do not create an other contact. I know about getContactById( ) but that is not what I need. I need to query based on the email field similar to a wix-data wixdata.query(). Can this be done. If so what method(function) do I use?
So you will want to be using the Wix CRM as that deals with all Contacts, of which not all of those will be actual Site Members. Do not use Wix Users as that is for Site Members.
What’s the difference between wix-crm and wix-users?
The CRM API contains functionality for working with your site’s contacts. The Users API contains functionality for working with users who are logged-in members. Note that all members are also contacts, but contacts are not necessarily members.
https://www.wix.com/corvid/reference/wix-crm.html
Then you can just simply query the email that the user has given using the eq function to see if they already have an existing data entry with that email address.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq
Thanks for your reply. What is the name of collection for site contacts? I have also tried createContact( ). How ever that does not seem to work as documented. If the contact exists it is updating info but not returning the contact id. If contact does not exist it creates the contact and returns the contactId
Wix experts,
A suggested approach is to use WixData Query. Does anyone know what collection to use to query site contacts? I know how to query just don’t know what collection to use. What is the value of xxxx in below
wixData.query(“xxxx”)
.eq(“email”, “[x@x.com]”)
.find()
Does anyone knows how to query teh contacts collection? Is this even posible?
Hi there! What would be the name of the collection for querying the contacts database?
same problem, how do I query contacts?
This is an old post and is being closed.
If you have further questions please open up a new thread. Please read the Community Guidelines .