A few months ago we were trying to follow best practices and associate some activities of contacts with opportunities. Each opportunity is associated with an account.

We had an error when we were doing our vlookup in excel that caused a lot of our contacts' activities to be associated with the wrong opportunity. To be clear the activity is still with the right contact but now is also associated with an opportunity linked to another account.

I haven't figured out the best way to clean this up. My first thought was to delete the opportunities and start over re-uploading those. I quickly learned this would not work because it deleted all the associated contact activities.

Any suggestions would be much appreciated. Thanks!

  • Is there a pattern to the activities you need to change? Would you be able to validate that logic programmatically in the context of Apex? – Brian Mansfield Apr 8 '15 at 21:24

If these "activities" are Task objects, by looking at SFDC Object reference, you can see that the Opportunity is represented by the field WhatId and the Contact is represented by the field WhoId

You could export all of your Tasks using Data Loader for the datetime range in question and then delete the cells for WhatId and then use Data Loadder again to update the Task records

Note that Contacts (whoId) will always start with the characters 003 so be sure to avoid in your excel manipulation of the Data Loader output any rows where whoId does not start with 003

Note that Opportunities (whatId) will always start with the characters 006 so you can avoid inadvertently disassociating Contact tasks linked to sobjects other than Opportunities.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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