What's happening in the contacts?

Am i missing something ???

After deletion of a contact by → CODE, the deleted contact do not exist anymore in Wix-Crm regarding it from the DASHBOARD…—> 16 existing Contacts


Also not existing anymore in the PDM… —>16-Entries

But still queriying all of OLD-Contacts which were existing before ???

Velo-Ninja exist either in the PMD nor in the wix-crm (contacts) anymore.
There are also just 16-Contacts which are existing at current time. Also the PMD do have 16-Entries.

Why the QUERY-RESULT gives —> 26 as RESULT?

@yisrael-wix

Can you perhaps check this illogical behaviour?
Seems to be a bug on VELO/Wix-side.

User are deleted perfectly in the Wix-Contacts-List and also in the PMD, but still are existing → when query the contacts.

That does not make any sense.:roll_eyes:

All the shown Users on the following screenshot were deleted and are not existing anymore in contacts and PMD…but still existing in the contacts-query, as you can see…

You can test it here by your own…

https://russian-dima.wixsite.com/login-system

The → “Delete-Account”-button can be found in the SETUP-AREA.
To delete an existing Account → you have to be logged-in.

Console-logs are opened…

Mr-President is waiting for an answer :joy:…THANKS!

Hi Dima,
Did you migrate to the new deleteContact API? In the API ref it states: If the contact is also a site member, the member must be deleted first, and then the contact can be deleted.

What do you mean by PMD?

I’ll share this information with our Support team so they can investigate the potential bug. They will contact you via email to continue the conversation.

@marlowe-shaeffer

Hello miss Marlowe, happy to hear from you.

Ok, yes i have read the following already in the API…

In the API ref it states: If the contact is also a site member, the member must be deleted first, and then the contact can be deleted.

And yes, i used the new one (not the depricated one)…
https://www.wix.com/velo/reference/wix-crm-backend/contacts-obj/deletecontact

And yes, first i deleted the membership…(even gave it a little time-delay, without any luck…

At first the user should be deleted from the PMD, then from Contacts, if i understood the statement in the API right.

let msgPMD = await deleteCurrentUser(); console.log(msgPMD);
setTimeout(async()=>{let msgContact = await deleteContact(); console.log(msgContact);},1500);   

PMD → PrivateMembersData

//Delete-User...
export function deleteCurrentUser() {
  let user = wixUsersBackend.currentUser;
  wixUsersBackend.deleteUser(user.id)
  .then(()=> {let message="Your account has been deleted!"; return(message)})
  .catch((err) => {console.log("Something gone wrong!!!"); return(message)});
}

CRM → Contacts

export function deleteContact(contactID) {
  //const contactId = "43fd5f9e-d7d4-4a31-8bfc-3bdc180cc40a";
  const options = {suppressAuth: true};
  return contacts.deleteContact(contactID, options)
  .then(() => {let msg="Contact deleted"; return msg;})
  .catch((error) => {let msg=error; return msg;});
}

As already mentioned → Everythings works.
Contacts gets deleted.
Also deletion from PMD works well.

But only thing whats not working well → When you query CONTACTS → you get all contacts again (including the deleted one).

This is not the behaviour i was expecting. Here someone should take a coding hand on this issue and make some improvements.

And by the way… the coder who will improve it, perhaps also should take a look onto the inconsitent/incomplete → ROLE-API. Why???

Comparing with the BADGE-API → The ROLE-API is very poor! It should get the same possibilities like the Badge-API.

And a last little improving-suggestion…
When quering the contacts, a lot of informations are included YES, BUT very important ones are missing inside the query…

Including for example → ROLES / BADGES and surely more important things.

Either it should be able to get all this data from CRM or from PMD.

But either the one is possible, nor the other as i see it.
That means at the end both of DBs are inconsistent and useless, so you have to create a THIRD OWN DATABASE, where you have to store all needed/wanted user-data.

Just a suggestion :wink:

To see where such things are needed, just take a look onto my already shown Login-Example.

Edit:
Yes i know there is a given possibility to get badges…
https://www.wix.com/velo/reference/wix-users-backend/badges-obj/listmemberbadges

But it could be better, already included in one of the mentioned DATABASES.

And for ROLES, there is even absolutely no given possibility in this direction.

Just the possibility to get ROLES per single user. :expressionless::expressionless::expressionless::expressionless::expressionless::expressionless::expressionless::expressionless:

Perhaps some additional informations on this issue…

After one User has been deleted and you try to register the same account with the same registration-values, you get this one…

In english → this is an → E-Mail-Approvement, which i have never been activated in my Login-System.

I don’t know how to interpret or explain this behaviour.

Ok, never mind :grin: i found the solution for my problem.
I checked one more time my whole setup, until i recognized, that the contacts still were existing and were not deleted at all as i misleading described in my first few comments.

I tested another of the given APIs in the API-DOCs.
I do not know, if this one is a depricated one or not, but it worked for me…

import wixCrmBackend from 'wix-crm-backend';
2
3export function deleteContactForcefully(contactId) {
4  const options = {
5    "deleteMembers": true
6  };
7  
8  wixCrmBackend.deleteContact(contactId, options)
9    .then( () => {
10      // contact has been deleted
11    })
12    .catch( (err) => {
13      // there was an error deleting the contact
14    });
15}

Here you can force to delete the contact —> CONTACT-DELETED —> MISSION-COMPLETE !!! :grin:

AND!!! → It doesn’t matter → if you first delete contact or member, it works in both cases. :wink:

First problem could be resolved.

Also the issue with the APPROVING is now resolved. It was a consequential issue of the first one.

But perhaps someone can take a look onto my other suggestion though ,please.