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?

1 Answer 1


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.


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.

  • Thank you @sfdcfox. this works, but it is really bad if I want later on to automate this process. also - do you know if I need to get all related components of the workflow rule (alerts, updates etc.)? otherwise deploy with part of them can remove the missing parts? Dec 13, 2021 at 13:38
  • @ItaiShmida (a) Deploying a rule already deployed should have no effect; you can automate this. (b) You should retrieve all parts (e.g. force:source:retrieve -m Workflow) to make sure you don't miss anything.
    – sfdcfox
    Dec 13, 2021 at 13:53
  • 'force:source:retrieve -m "Workflow:work flow name" does not work do I have to get all workflows for that? Dec 13, 2021 at 15:32
  • @ItaiShmida You can get Workflow (no qualifiers) for all objects, or Workflow:ObjectName to get all workflows on a single object, including all attached field updates, outbound messages, etc.
    – sfdcfox
    Dec 13, 2021 at 15:50
  • This is too risky, we have sandboxes that admins are working on and sometimes not refreshed and they have many differences from production. With this approach I can deploy components that are not needed. So actually the current solution from Salesforce is not good enough. This is also on email templates, @sfdcfox do you know any other problematic component types? Dec 14, 2021 at 6:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .