1

Some CampaignMember records are deleted and after that when I run a SOQL query without any filter criteria in code or query editor, it fetches all the campaign members with deleted ones, also their isDeleted is set as false, and after that when I try to open their detail page it shows as 'Data not available.

When I run the SOQL query i.e.

SELECT Id FROM CampaignMember

But it gives me the result(for e.g.) as 5 records but from these 5 records, 4 records are already deleted, but they are coming in SOQL query result, as well in Apex code. when I try to open these 4 record detail pages, it shows 'Data not available'.

And when I run this SOQL query

SELECT Id, CreatedDate FROM CampaignMember

then it gives the result of 1 record. that exists in the database

Deleted records should not appear in a standard SOQL query.

As CampaignMember does not support UNDELETE call so can't make this call on those records(can't be find in recycle bin) When I try to delete them manually, shows me the error

System.DmlException: Delete failed. First exception on row 0 with id <ID>; 

first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
5
  • Do the Campaignmembers show as 5 records in both Lightning and Classic? Sep 26, 2023 at 14:06
  • I've seen a similar scenario recently where there was a discrepancy in Campaign member records in LEX and Classic i.e., a) Count of Campaign Members mismatch on Lex Campaign member RL vs Classic Campaign member RL b) On Lightning Campaign Members RL, sorting Name ASC vs DESC returns different count of result. If you are seeing the same behaviour, can you please share your orgId so I can confirm if it is related to a Salesforce bug? Sep 26, 2023 at 14:42
  • As the Developer console query editor giving the incorrect result, so I think it must be a Salesforce bug. [SELECT Id FROM CampaignMember] and [SELECT Id, Name FROM CampaignMember], both queries give different record counts. Facing this issue in the production org, and in the staging org it's working fine. Sep 27, 2023 at 16:13
  • Please consider logging a support case and share the case number here so I can own and help you further. Sep 28, 2023 at 7:10
  • 1
    For the benefit of the community, please inform us when this bug will be fixed in upcoming releases. Thank you for informing me about the bug update. Oct 9, 2023 at 6:20

1 Answer 1

0

The issue you are facing is related to a known bug within Salesforce #W-14113900 and the ETA for the fix is 246 patch releases(which is around mid-Oct-Nov , Safe Harbour).

Because of this bug,

  • Deleted Campaign Members would still be showing up on UI and cannot be deleted again.
  • There would be a discrepancy in Campaign member records in LEX and Classic. a) Count of Campaign Members mismatch on Lex Campaign member RelatedList vs Classic Campaign member RelatedList b) On Lightning Campaign Members RelatedList, sorting Name ASC vs DESC returns a different count of the result

The root cause is the issue of the data in Campaign Member skinny table that was not maintained correctly during hard-delete operation.

Please consider logging a support case so I can help in deactivating the CampaignMember skinny table to fix the issue for now for your prod org.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .