-1

I am attempting to remove all references of a managed package that is going to be uninstalled that spans throughout code base in VS Code

I have using a query to find the field permissions but am wondering if there is a way to search for the reference outside of specifying the exact field name compared to the field containing only "agf" since they are all using it.

Below is the search query:

<fieldPermissions>
    <editable>false</editable>
    <field>User.agf_Certified_Product_Owner__c</field>
    <readable>false</readable>
</fieldPermissions>

In the field, I want to be able to find and delete the 5 associated lines from multiple files if they match "agf" in any combination. Something like the below:

<fieldPermissions>
    <editable>false</editable>
    <field>agf</field>
    <readable>false</readable>
</fieldPermissions>

With any combination of agf in the field, delete all from any file it appears in.

ForrestFairway
  • 133
  • 1
  • 11
  • Just to clarify, you want to delete the entire `...` element if the `` key contains the text `agf` anywhere in it? Can the containing element `fieldPermissions` vary but you still want to delete any and all containing elements if the `field` key conatins `agf`? – Mark Oct 10 '22 at 18:12
  • Correct, thanks for the clarity, the fieldPermissions will not vary only the field will – ForrestFairway Oct 10 '22 at 18:55

1 Answers1

0

Not an answer but too long for a comment

You don't have to? Profiles/perm sets don't block package's delete. Probably neither do reports.

You'd use your time better by searching for all instances of agf__ (that's with double underscore), should find fields, objects... used in classes, flows, page layouts etc. And search for agf. (with dot) should find all instances where your Apex code calls their classes marked as global.

Alternatively Apex / VF pages with dependencies on package will have it listed in their "meta.xml", for example

<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <packageVersions>
        <majorNumber>236</majorNumber>
        <minorNumber>1</minorNumber>
        <namespace>SBQQ</namespace>
    </packageVersions>
    <status>Active</status>
</ApexClass>

Last but not least - why not just spawn a dev sandbox and attempt the delete there? If it succeeds - great. If not - it'll list the dependencies that blocked the delete. It'll be "the real thing", it'll smite you even if your VSCode project doesn't contain all flows, layouts and thus could lull you into false sense of security. I'd seriously do it in sandbox and then run all tests for good measure, just in case there are some dynamic soql queries that don't count as hard, delete-blocking references.

After delete's done - fetch Profiles / Permsets from this org and the field references will be gone from the xml.

eyescream
  • 18,088
  • 2
  • 34
  • 46