forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
954 stars 406 forks source link

Retrieving v59 flow that includes the new Error_Message action fails from extension #5178

Closed MarcDBehr closed 12 months ago

MarcDBehr commented 1 year ago

Summary

We have a v59.0 flow that includes the new "Error Message" action. When the flow is downloaded using the extension (org browser or retrieve), a critical part of the flow (the customErrors section( is not retrieved.

Steps To Reproduce:

  1. Create a new v59.0 flow that includes the new "Error Message" action. In the action, define the error message.
  2. From VS Code, org browser, download the new flow
  3. Search the metadata for a section called "Error_Message" - Note that there is a connector reference to to it, but the message itself is not in the metadata.
  4. Use the CLI command "sf force source retrieve -m Flow:flow_name -a 59.0"
  5. Notice that the error message now exists

Expected result

The 'complete' flow version shoule be retrieved.

Actual result

Got a version of the flow that can't be deployed anywhere

Additional information

Feel free to attach a screenshot.

Salesforce Extension Version in VS Code:

v59.1.2

SFDX CLI Version:

@salesforce/cli/2.13.9 darwin-x64 node-v20.6.0

OS and version:

MacOS Version 14.0 (23A344)

VS Code version:

Version: 1.83.1 Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc Date: 2023-10-10T23:46:55.789Z (1 wk ago) Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin x64 23.0.0

CristiCanizales commented 1 year ago

Hi @MarcDBehr, I'm trying to repro this but even when running the sf command through the cli, the content of the xml is the same, with only the reference to the error. Could you send a screenshot of what you get when using our extensions and when sing the cli? Thanks in advance!

MarcDBehr commented 1 year ago

@CristiCanizales From the extension, it looks like:

`<?xml version="1.0" encoding="UTF-8"?>

59.0 Check_Lead_Status 314 323 Default Outcome Newly_Converted and Newlyconvertedlead EqualTo true Set_type_field_on_contact Default Indicates if this is a newly converted lead. Is this a new lead that is being converted (not likely) OR a lead that has just been converted AND there is an associated contact Newlyconvertedlead Boolean ((ISNEW() && {!$Record.IsConverted}) || ISCHANGED({!$Record.IsConverted})) && ! ISNULL({!$Record.ConvertedContactId}) Lead: After Save {!$Flow.CurrentDateTime} BuilderType LightningFlowBuilder CanvasMode AUTO_LAYOUT_CANVAS OriginBuilderType LightningFlowBuilder AutoLaunchedFlow Set_type_field_on_contact 50 431 Log_the_error and Id EqualTo $Record.ConvertedContactId Type__c IsNull true Type__c Sales Contact 188 0 Check_Lead_Status Lead CreateAndUpdate RecordAfterSave Active Log_the_error 314 539 Error_message Debug_Info_Subflow debugInfoCaller $Flow.InterviewGuid debugInfoDebugData $Flow.FaultMessage debugInfoEndPoint $Flow.CurrentRecord ` If I run the command line: "sf force source retrieve -m Flow:Lead_After_Save " I get: ` 59.0 Error_message 314 647 There was an error when trying to save the related contact. A log of the error has been saved. false Check_Lead_Status 314 323 Default Outcome Newly_Converted and Newlyconvertedlead EqualTo true Set_type_field_on_contact Default Indicates if this is a newly converted lead. Is this a new lead that is being converted (not likely) OR a lead that has just been converted AND there is an associated contact Newlyconvertedlead Boolean ((ISNEW() && {!$Record.IsConverted}) || ISCHANGED({!$Record.IsConverted})) && ! ISNULL({!$Record.ConvertedContactId}) Lead: After Save {!$Flow.CurrentDateTime} BuilderType LightningFlowBuilder CanvasMode AUTO_LAYOUT_CANVAS OriginBuilderType LightningFlowBuilder AutoLaunchedFlow Set_type_field_on_contact 50 431 Log_the_error and Id EqualTo $Record.ConvertedContactId Type__c IsNull true Type__c Sales Contact 188 0 Check_Lead_Status Lead CreateAndUpdate RecordAfterSave Active Log_the_error 314 539 Error_message Debug_Info_Subflow debugInfoCaller $Flow.InterviewGuid debugInfoDebugData $Flow.FaultMessage debugInfoEndPoint $Flow.CurrentRecord ` Notice the customErrors section in the second version.
CristiCanizales commented 12 months ago

Hi @MarcDBehr! Sorry for the delay. Could you tell me what's your sourceApiVersion in your sfdx-project.json?

MarcDBehr commented 12 months ago

{ "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "59.0" }

CristiCanizales commented 12 months ago

Could you try uninstalling sf cli and installing sfdx cli? Instructions here. Then, just try retrieving your flow. We've been playing around with versions and with sfdx cli it successfully retrieves the customErrors section. My sfdx version is: sfdx-cli/7.209.6 darwin-arm64 node-v18.15.0

MarcDBehr commented 12 months ago

But shouldn't we be moving away from from the sfdx CLI to the sf CLI? Are you suggesting that the extension does not work with the latest version of the CLI?

$ sf version @salesforce/cli/2.14.6 darwin-x64 node-v20.6.0 $ sfdx version @salesforce/cli/2.14.6 darwin-x64 node-v20.6.0

CristiCanizales commented 12 months ago

Yes, it's not mandatory though (yet). It was just to see if it worked for you and have more info to keep digging on the root cause.

daphne-sfdc commented 12 months ago

Hi @MarcDBehr, As another try, could you please clean the cache by deleting the .sfdx and .sf folders from the Explorer (left panel) and deleting the flow that you retrieved, then reload the VSCode window by running "Developer: Reload Window" from the command palette? If that also does not fix the issue, please try restarting your computer. Thanks a lot for trying with us.

MarcDBehr commented 12 months ago

@daphne-sfdc I deleted the .sf and .sfdx folders and then I deleted the local version of the flow and reloaded the window. Next, I went to org browser and downloaded the flow and this time, I can see the error message correctly. So.... I guess there was something in the cache that was being referenced rather than the org itself? If so, this same thing happened to several people here, so this does not seem to be an issue on a single system.

daphne-sfdc commented 12 months ago

Hi @MarcDBehr, Thank you very much for the confirmation, and glad to hear that everything is now working as expected on your system. We're not sure why there is the cache issue, and you're right that it's not specific to any orgs, projects, or systems - although the solution to clean the cache has worked in most cases. Closing this issue as completed.