Sfdx.exe deploy WorkflowRule fails with “not found in zipped directory”

deploymentsalesforcedxsfdx-errorworkflowrule

I am working with sfdx

Trying to deploy a changed workflow from my sandbox to production

I am getting the workflow with no problems with this command:

sfdx force:source:retrieve -m WorkflowRule:myObject__c.myWorkflowRule

Now I try to deploy and I always get an error:

sfdx force:source:deploy -m WorkflowRule:myObject__c.myWorkflowRule

The error:

An object 'myObject__c.myWorkflowRule' of type
WorkflowRule was named in package.xml, but was not found in zipped
directory

Is there something I am doing wrong?

If is is a bug – Is there a different way to deploy WorkflowRules with sfdx?

Best Answer

Because of how WorkflowRule files are constructed, you can't deploy just one rule at a time. I'm not sure if it's a bug or a limitation, but I can say that you need to deploy all the workflow rules for an Object if you're using the CLI; you can't deploy just one.

Try:

sfdx force:source:deploy -p force-app/main/default/workflows/myObject__c.workflow-meta.xml

Replace the path with the appropriate path for your project.