hardisgroupcom / sfdx-hardis

Swiss-army-knife Toolbox for Salesforce. Orchestrates base commands and assist users with interactive wizards to make much more than native sfdx + Allows you to define a complete CI/CD Pipeline and Schedule a daily Metadata backup & monitoring of your orgs
https://sfdx-hardis.cloudity.com
GNU Affero General Public License v3.0
212 stars 41 forks source link

📢 sfdx-hardis v5 has been released ! #795

Open nvuillam opened 2 months ago

nvuillam commented 2 months ago

See release notes !

https://github.com/hardisgroupcom/sfdx-hardis/releases/tag/v5.0.1

If you see any issue, please create them and post a comment here :)

alesremta-ext43767 commented 2 months ago

Hi @nvuillam . I noticed a problem with purging flows.. and then noticed it may be with all commands? https://github.com/hardisgroupcom/sfdx-hardis/issues/800

maybe/hopefully it's just me

alesremta-ext43767 commented 2 months ago

I also have a question about the new attribute for org:purge:flow delete-flow-interviews. It seems to have the same short-hand name -f as allowpurgefailure? Can I run with the delete interviews options without a prompt?

nvuillam commented 2 months ago

It seems to have the same short-hand name -f as allowpurgefailure

@alesremta-ext43767 Good catch, it is a bug... that I just solved in v5.0.6 :)

Can I run with the delete interviews options without a prompt?

You could not because I forgot to handle it, but with v5.0.6 you can, please can you confirm ?

sf hardis:org:purge:flow --no-prompt --delete-flow-interviews

alesremta-ext43767 commented 2 months ago

You could not because I forgot to handle it, but with v5.0.6 you can, please can you confirm ?

~Not yet @nvuillam, still having issues with https://github.com/hardisgroupcom/sfdx-hardis/issues/800~ with the skipauth I can of course run this :-) seems to work, but also seems to delete the Flow Interviews even if I don't include the --delete-flow-interviews attribute

nvuillam commented 2 months ago

Probably a remaining tiny bug ^^ I'll check :)

nvuillam commented 2 months ago

@alesremta-ext43767 according to the code, it will delete prompts interview:

Such behaviour such ok to me... do you confirm ? :)

alesremta-ext43767 commented 2 months ago

Such behaviour such ok to me... do you confirm ? :)

It's not quite right in my case I think @nvuillam. I am in CI mode (no prompt) but did not specify to delete Flow Interviews, but it did anyway.

XXXXXXXX-core % sf hardis:org:purge:flow --no-prompt --skipauth --targetusername automation
Warning: The "--targetusername" flag has been deprecated. Use "--target-org | -o" instead.
[sfdx-hardis][command] sf data query  --query "SELECT Id,MasterLabel,VersionNumber,Status,Description,Definition.DeveloperName FROM Flow WHERE ManageableState IN ('deprecatedEditable','installedEditable','unmanaged') AND Status IN ('Obsolete') ORDER BY Definition.DeveloperName,VersionNumber" --target-org automation@newport-bigdipper-8879.cz --use-tooling-api --json
[sfdx-hardis] Found 1 records:
ID                 MASTERLABEL   VERSIONNUMBER DEFINITIONDEVNAME STATUS   DESCRIPTION
301RR00000OX3vJYAT Create a Case 7             Create_a_Case     Obsolete            
[sfdx-hardis] [ToolingApi] Delete 1 records on Flow: ["301RR00000OX3vJYAT"]
[sfdx-hardis] [ToolingApi] jsforce error while calling Tooling API. Fallback to to unitary delete (longer but should work !)
[sfdx-hardis] The requested resource does not exist
✖ [sfdx-hardis][command] sf data:delete:record --sobject Flow --record-id 301RR00000OX3vJYAT --target-org automation@newport-bigdipper-8879.cz --use-tooling-api --json
[sfdx-hardis] Unable to perform deletion request: {"Id":"301RR00000OX3vJYAT","success":false,"error":"{\"status\":1,\"errorMessage\":\"[sfdx-hardis][ERROR] Error processing command\\n${\\n  \\\"name\\\": \\\"DEPENDENCY_EXISTS\\\",\\n  \\\"message\\\": \\\"This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS. This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS.\\\",\\n  \\\"exitCode\\\": 1,\\n  \\\"context\\\": \\\"Delete\\\",\\n  \\\"stack\\\": \\\"DEPENDENCY_EXISTS: This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS. This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS.\\\\n    at SfCommandError.from (file:///opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@salesforce/sf-plugins-core/lib/SfCommandError.js:39:16)\\\\n    at Delete.catch (file:///opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@salesforce/sf-plugins-core/lib/sfCommand.js:316:47)\\\\n    at Delete._run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/command.js:305:29)\\\\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\\\\n    at async Config.runCommand (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:424:25)\\\\n    at async run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:95:16)\\\\n    at async file:///opt/homebrew/lib/node_modules/@salesforce/cli/bin/run.js:15:1\\\",\\n  \\\"cause\\\": \\\"undefined\\\",\\n  \\\"warnings\\\": [],\\n  \\\"code\\\": \\\"DEPENDENCY_EXISTS\\\",\\n  \\\"status\\\": 1,\\n  \\\"commandName\\\": \\\"Delete\\\"\\n}\\n\\n\",\"error\":{\"code\":1,\"killed\":false,\"signal\":null,\"cmd\":\"sf data:delete:record --sobject Flow --record-id 301RR00000OX3vJYAT --target-org automation@newport-bigdipper-8879.cz --use-tooling-api --json\",\"stdout\":\"{\\n  \\\"name\\\": \\\"DEPENDENCY_EXISTS\\\",\\n  \\\"message\\\": \\\"This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS. This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS.\\\",\\n  \\\"exitCode\\\": 1,\\n  \\\"context\\\": \\\"Delete\\\",\\n  \\\"stack\\\": \\\"DEPENDENCY_EXISTS: This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS. This flow version is referenced elsewhere in Salesforce. Remove the usage and try again. : Flow Interview - 0FoRR000005oSMS.\\\\n    at SfCommandError.from (file:///opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@salesforce/sf-plugins-core/lib/SfCommandError.js:39:16)\\\\n    at Delete.catch (file:///opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@salesforce/sf-plugins-core/lib/sfCommand.js:316:47)\\\\n    at Delete._run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/command.js:305:29)\\\\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\\\\n    at async Config.runCommand (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:424:25)\\\\n    at async run (/opt/homebrew/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:95:16)\\\\n    at async file:///opt/homebrew/lib/node_modules/@salesforce/cli/bin/run.js:15:1\\\",\\n  \\\"cause\\\": \\\"undefined\\\",\\n  \\\"warnings\\\": [],\\n  \\\"code\\\": \\\"DEPENDENCY_EXISTS\\\",\\n  \\\"status\\\": 1,\\n  \\\"commandName\\\": \\\"Delete\\\"\\n}\\n\",\"stderr\":\"\"}}"}
[sfdx-hardis] [BulkApiV2] SELECT Name,InterviewLabel,InterviewStatus,CreatedBy.Username,CreatedDate,LastModifiedDate FROM FlowInterview WHERE Id IN ('0FoRR000005oSMS') ORDER BY Name
✔ [BulkApiV2] Bulk Query completed with 1 results.
[sfdx-hardis] Flow interviews to be deleted would be the following:
NAME     INTERVIEWLABEL                INTERVIEWSTATUS CREATEDBY.USERNAME            CREATEDDATE              LASTMODIFIEDDATE        
00000012 Create a Case 27.09.2024 9:50 Error           test-uydfb6qqt3sk@example.com 2024-09-27T07:50:34.000Z 2024-09-27T07:50:34.000Z
[sfdx-hardis] SOQL BULK on object FlowInterview with action delete (1 records)
✔ Bulk Load on FlowInterview (delete) completed.
[sfdx-hardis] Trying again to delete flow versions after deleting flow interviews...
[sfdx-hardis] [ToolingApi] Delete 1 records on Flow: ["301RR00000OX3vJYAT"]
[sfdx-hardis] [ToolingApi] jsforce error while calling Tooling API. Fallback to to unitary delete (longer but should work !)
[sfdx-hardis] The requested resource does not exist
✔ [sfdx-hardis][command] sf data:delete:record --sobject Flow --record-id 301RR00000OX3vJYAT --target-org automation@newport-bigdipper-8879.cz --use-tooling-api --json
[sfdx-hardis] {
  "status": 0,
  "result": {
    "id": "301RR00000OX3vJYAT",
    "success": true,
    "errors": []
  },
  "warnings": []
}

[sfdx-hardis] Deleted the following list of record(s):
0               ID                 SUCCESS
[object Object]                           
                301RR00000OX3vJYAT true   
[sfdx-hardis] hardis:org:purge:flow execution time 0:00:27.794
nvuillam commented 2 months ago

I don't understand :'(

image

Any chance you could debug locally ? 😇

https://sfdx-hardis.cloudity.com/#contributing

alesremta-ext43767 commented 2 months ago

Any chance you could debug locally ? 😇 Challenge, but I'll try - though it'll take me time, this weekend is busy :-)

Though in your conditions: 1) is true, cos there were errors 2) is true, cos it's CI (so this.deleteFlowInterviews don't matter) 3) seems to be called with True from line 125

so I'd say it's number 2?