How to delete all emails linked to a contact record, when the contact record / email address was created without intention

Version 1

    SCENARIO:

    One of our users accidentally got added to GoldMine as a contact, and we have now got a lot of emails linked to this contact record in GoldMine.

    Is there a way of removing these emails, either via the GoldMine application or via a SQL script?

     

    INFORMATION:

    There is no such possibility by default within GoldMine because when deleting the contact record itself the emails remain in the system as unlinked emails which in this case, is not the real goal.

     

    When there were only a few emails linked to the contact record it is always recommended to delete them manually from within GoldMine, either one by one from the Pending / History tab or from the E-Mail Center

     


    When there are really a lot of emails linked to the contact record which makes it not possible to delete them manually from within GoldMine another option at this point is a SQL script / are SQL Queries.

    Please keep in mind that GoldMine Technical Support does not officially support SQL Scripts and the following information is only provided as is without any warranty.

    Also, it must be clear that any back-end manipulation of data is not sync-aware so that when synchronization is in place the script/queries should be also run on remotes or other sites.

    It is absolutely recommended that a full running backup prior performing a mass deletion action.

    - An email record has always also either a Pending (CAL) record or a historical (CONTHIST) record, so it is recommended to make sure that both related items are deleted and not only the emails in the MAILBOX table themselves.

    - Also, it requires that these emails are linked to a contact record so that the thing to be done is to figure out the related ACCOUNTNO of the contact record. This can be done via

    1. Log into GoldMine with master rights
    2. Browse to the contact record
    3. CTRL + SHIFT + D (this opens the dBASE  Expression Tester)
    4. Enter ACCOUNTNO >> Eval
    5. The result shows the ACCOUNTNO field content from the current record (which is the User's contact record) and you can copy the result into the Windows Clipboard via the Copy button

    - When you want (which would be recommended) to delete the related CAL and CONTHIST records for the emails then you have to start with those as otherwise the necessary information from the MAILBOX table will be gone.

    delete from cal where linkrecid in (select recid from mailbox where accountno like 'paste the accountno from above for the contact record')


    delete from conthist where linkrecid in (select recid from mailbox where accountno like 'paste the accountno from above for the contact record')


    - Only after that you should now delete the related MAILBOX entries

    delete from mailbox where accountno like 'paste the accountno from above for the contact record')


    This takes care of only existing emails but does not delete the contact record itself, either the contact record should now also be deleted via
    1. Edit >> Delete Contact
    2. Select desired options for deletion
    3. Delete Button

    Or at least the email address from the contact record removed so that no new emails are again linked to the contact record

    1. Click into the email field
    2. Highlight the specific email address >> Delete button >> Yes Button for deletion confirmation