[SalesForce] How to resolve “Required field is missing: name” when deploying Flow

I am deploying a flow using SFDX using metadata format. Here's the relevant package.xml entry:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>My_Flow</members>
        <name>Flow</name>
    </types>
    <version>53.0</version>
</Package>

When deploying this, I get the following error:

Type: Flow Version

Error Message: Required field is missing: name

I'm not sure how to solve this. I tried backing down the API version from 53 to 52, 51, 50, etc. but that just resulted in additional errors.

My sfdx-project.json sourceApiVersion is 52.0 and I'm running the following command to deploy the code:

sfdx force:mdapi:deploy -d deploy -u MyTargetOrg

Note, I have included 3 other flows in the deployment that don't raise an error. Here's the flow that's causing the problem. It may be worth noting this is the only flow in the set that is using Async features:

enter image description here

Best Answer

There is some problem with sfdx force:source:deploy/retrieve when we indicate concrete
--apiversion from command line. It's better to change sourceApiVersion in sfdx-project.json file.

Example for sfdx-cli 7.114.0 and Flow with Asynchronously path (without any Action):

  1. "sourceApiVersion": "51.0"
    sfdx force:source:retrieve -p force-app\flows\ -a 53.0
    Retrieved metadata:
<scheduledPaths/>
  1. "sourceApiVersion": "53.0"
    sfdx force:source:retrieve -p force-app\flows\
    Retrieved metadata:
<scheduledPaths>
   <pathType>AsyncAfterCommit</pathType>
</scheduledPaths>
  1. "sourceApiVersion": "51.0"
    sfdx force:source:deploy -p force-app\flows\ --apiversion 53.0
    Results:
Error  force-app\sales\flows\FlowApiName.flow-meta.xml
Property 'pathType' not valid in version 51.0 (138:25
ERROR running force:source:deploy:  Deploy failed.

Unfortunately pathType for Run Asynchronously option is not documented in Metadata API: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_visual_workflow.htm

We can find it only in Metadata WSDL (file downloaded from setup).

Related Topic