Created
January 30, 2025 02:22
-
-
Save jkentjnr/6bf40f016cae4027a556563164690166 to your computer and use it in GitHub Desktop.
Delete NPC Data from Environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String prefix = 'cte'; | |
// Get gift transactions | |
List<GiftTransaction> lstGT = [SELECT Id FROM GiftTransaction WHERE md_npc_pack__Platform_Key__c LIKE :prefix + '%']; | |
System.Debug(lstGT); | |
// Delete installments associated with Gift Transasctions | |
List<cpm__Installment__c> lstI = [SELECT Id FROM cpm__Installment__c WHERE fdff__GiftTransaction__c IN :lstGT]; | |
System.Debug(lstI); | |
if (lstI.size() > 0) delete lstI; | |
// Delete gift transactions | |
delete lstGT; | |
// -------------------------- | |
// Delete gift commitments | |
List<GiftCommitment> lstGC = [SELECT Id FROM GiftCommitment WHERE md_npc_pack__Platform_Key__c LIKE :prefix + '%']; | |
System.Debug(lstGC); | |
delete lstGC; | |
// -------------------------- | |
// Delete campaigns | |
List<Campaign> lstC = [SELECT Id FROM Campaign WHERE movedata__Platform_Key__c LIKE :prefix + '%']; | |
System.Debug(lstC); | |
delete lstC; | |
// -------------------------- | |
// Get Accounts by Key | |
List<Account> lstA = [ | |
SELECT Id FROM Account WHERE Id IN (SELECT movedata__Account__c FROM movedata__Account_Platform_Key__c WHERE movedata__Platform_Key__c LIKE :prefix + '%') | |
]; | |
System.Debug(lstA); | |
delete lstA; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment