amtrack / sfdx-browserforce-plugin

sfdx plugin for browser automation
MIT License
109 stars 38 forks source link

feat: add emptyOrgRecycleBin to clean up space used by large amounts of records in the recycle bin #492

Closed mkreth closed 1 year ago

mkreth commented 2 years ago

Adds a new plugin EmptyOrgRecycleBin that will navigate to the Recycle Bin Lightning Page (/lightning/o/DeleteEvent/home) and press the "Empty Org Recycle Bin" button.

As this does not represent a "setting" in Salesforce, the plugin will simply always return { enabled: false } from its retrieve() method. To empty the org recycle bin, apply the following setting (with enabled set to true):

  "settings": {
    ...
    "emptyOrgRecycleBin": {
      "enabled": true
    }
    ...
  }

This will execute the plugins apply method and empty the recycle bin.

Closes #486

mkreth commented 2 years ago

@amtrack I'm aware that tests are missing. I wanted to get this out to you, so you could have a look whether this is going in the right direction.

The button in the Recycle Bin lightning page does not have a unique identifier. To work around this, this plugin queries the label of the button action via the UI API and clicks the button with that label. In the next, modal confirmation dialog, the plugin simply clicks on the last button in the bottom bar of the modal. As long as Salesforce keeps their sequence of buttons (Cancel - Ok, Cancel - Empty, etc) this will work.