2

Can we not deploy BeforeSave Flows using DX or any other method? Using sfdx-cli/7.46.3 win32-x64 node-v12.13.0. Error when using sfdx force:source:deploy

Because the TriggerType field has the value "RecordBeforeSave", you also need to set the following fields: SaveType

3 Answers 3

3

I had the same problem and it was solved by updating the sfdx version with sfdx update to version 7.47.0

Since the RecordBeforeSave is new, the previous version of sfdx is not able to handle it properly, like for example, bring the SaveType property of the Flow, which triggers the error.

Below is a part of the xml of a flow which was fetched with a not up to date sfdx version

<start>
    <locationX>105</locationX>
    <locationY>50</locationY>
    <connector>
        <targetReference>Get_Hierarchy</targetReference>
    </connector>
    <object>BP_Hierarchy_Relationship__c</object>
    <triggerType>RecordBeforeSave</triggerType>
</start>

And here after updating it

<start>
    <locationX>105</locationX>
    <locationY>50</locationY>
    <connector>
        <targetReference>Get_Hierarchy</targetReference>
    </connector>
    <object>BP_Hierarchy_Relationship__c</object>
    <recordTriggerType>CreateAndUpdate</recordTriggerType>
    <triggerType>RecordBeforeSave</triggerType>
</start>

As shown, now the property <recordTriggerType> is fetched when requested with a sfdx version up to date and you won't have this error anymore.

1
  • What version of SFDX are you on now? As of the latest SFDX build on Feb 21 7.47.0 was still getting this. Salesforce seemed to confirm the issue so possible issued this fix since then?
    – ddeve
    Commented Feb 23, 2020 at 21:46
0

Like Leandro said, using "sfdx update" solves the problem. Remember to also change version in package.xml, I changed to 48 and it solved the problem.

1
  • Modified Leandro response so I could mark as answer. Saying "sfdx update" by itself doesn't tell others where fix was put in. Many do not want to get on latest versions for myriad reasons. As of my post the error existed confirmed by Salesforce. Subsequent they updated DX and must have patched so versions starting with 7.47.0 should be ok going forward. I wasn't using a package.xml so that doesn't affect this.
    – ddeve
    Commented Feb 25, 2020 at 15:50
0

Not expecting this to be the answer, but here's the tips to solve in steps:

Run "sfdx update" in terminal

  1. Restart vscode after update
  2. force source pull
  3. look for <recordTriggerType>
  4. If it is there, great commit changes to your branch
  5. If not, change package.xml to 50.0+, save it
  6. go to step 2 again

All else fails

Add this under <triggerType> in the flow xml files 

<recordTriggerType>CreateAndUpdate</recordTriggerType>
or 
<recordTriggerType>Update</recordTriggerType>
or 
<recordTriggerType>Create</recordTriggerType>

You must log in to answer this question.

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