global class UninstallClass implements UninstallHandler { global void onUninstall(UninstallContext ctx) { List config = new List(); config = database.query('select '+Checkaccessibility.isAccessible('id,HIC_ShopifySync__Update_Identified_Contact_Records__c, HIC_ShopifySync__Update_Identified_Account_Records__c, HIC_ShopifySync__Upsert_Account_basis_on_Customer_Company__c, HIC_ShopifySync__Upsert_Customer_basis_on_Email__c, HIC_ShopifySync__DNCDAMissingAccounts__c, HIC_ShopifySync__Shopify_Objects__c, HIC_ShopifySync__Turn_on_DND_synced_Customers__c,HIC_ShopifySync__Store__c,HIC_ShopifySync__IsCurrencyChanged__c,HIC_ShopifySync__Inventory_Location__c,HIC_ShopifySync__Cryptokey__c,HIC_ShopifySync__BatchRunOnce__c,HIC_ShopifySync__BatchisAborted__c,HIC_ShopifySync__Order__c,HIC_ShopifySync__OrderBatchCompleted__c,HIC_ShopifySync__Collection__c,HIC_ShopifySync__Batch_Is_Processing__c,HIC_ShopifySync__Enable_Draft_Order__c ,HIC_ShopifySync__Refresh_Token__c,name,HIC_ShopifySync__API_Key__c, HIC_ShopifySync__Shopify_URL__c,HIC_ShopifySync__Opportunity__c, HIC_ShopifySync__Private_Key_Password__c, HIC_ShopifySync__Salesforce_Site_URL__c, HIC_ShopifySync__Opportunity_Sync__c, HIC_ShopifySync__Inventory_Location_Sync__c, HIC_ShopifySync__Collection_Sync__c, HIC_ShopifySync__Product_Sync__c, HIC_ShopifySync__Customer_Sync__c, HIC_ShopifySync__Order_Sync__c, HIC_ShopifySync__Draft_Order_Sync__c, HIC_ShopifySync__Salesforce_Pricebook__c','HIC_ShopifySync__HIC_Configuration__c')+' from HIC_ShopifySync__HIC_Configuration__c Where HIC_ShopifySync__Store__c != \'Default\' order by LastModifiedDate desc'); HIC_ShopifySync.HIC_ShopifyUtility.deleteCustomAppFromStore(config); /*FeedItem feedPost = new FeedItem(); feedPost.parentId = ctx.uninstallerID(); feedPost.body = 'Thank you for using our application!'; insert feedPost; User u = [Select Id, Email from User where Id =:ctx.uninstallerID()]; String toAddress= u.Email; String[] toAddresses = new String[] {toAddress}; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setToAddresses(toAddresses); mail.setReplyTo('support@package.dev'); mail.setSenderDisplayName('My Package Support'); mail.setSubject('Package uninstall successful'); mail.setPlainTextBody('Thanks for uninstalling the package.'); Messaging.sendEmail(new Messaging.Email[] { mail })*/ } }