You need to sign in to do that
Don't have an account?
Sonali Sharma 54
Delete the Selected sObject or field from Org using apex
Need to delete custom lookup field from the Apex class
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Upon some research, I am not really sure if that is possible (would be happy to learn if otherwise) - https://ideas.salesforce.com/s/idea/a0B8W00000Gdm2SUAR/ability-to-update-metadata-from-apex-apex-metadata-api
Side note - I'm not really sure on your use case but if you are trying to mass delete, you can always leverage any deployment tool or even VS Code.
Thanks,
Karthik
You should be able to delete custom fields via metadata API
From https://salesforce.stackexchange.com/questions/362784/delete-customfield-using-tooling-api, If you need to delete CustomField metadata through an API, then using deploy() through the Metadata API is likely the way to go. You will need to deploy destructive changes to the org. An example destructiveChanges.xml file:
Related:
https://github.com/financialforcedev/apex-mdapi/issues/112
Creating custom field using Metadata API : https://developer.salesforce.com/forums/?id=9062I000000IXiyQAG
If this information helps, please mark the answer as best. Thank you