Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force:data:record:update returns generic error when validation rule fails #1327

Closed
dalden1981 opened this issue Dec 15, 2021 · 7 comments
Closed
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue

Comments

@dalden1981
Copy link

Summary

When using the force:data:record:update command, if the data violates a validation rule; the system returns Failed to update record with code FIELD_CUSTOM_VALIDATION_EXCEPTION. Fields: [] instead of the provided validation rule error message.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

NOTE: If your issue is not reproducable by dreamhouse-lwc, i.e. requires specific metadata or files, we require a link to a simple Salesforce project repository with a script to setup a scratch org that reproduces your problem.

  1. sfdx:force:data:record:update

Expected result

When submitting invalid data, the resulting error message should contain the validation rule's error message.

Actual result

Failed to update record with code FIELD_CUSTOM_VALIDATION_EXCEPTION. Fields: []

System Information

  • If you are using sfdx
    {
    "cliVersion": "sfdx-cli/7.130.1",
    "architecture": "win32-x64",
    "nodeVersion": "node-v16.13.1",
    "pluginVersions": [
    "@oclif/plugin-autocomplete 0.3.0 (core)",
    "@oclif/plugin-commands 1.3.0 (core)",
    "@oclif/plugin-help 3.2.18 (core)",
    "@oclif/plugin-not-found 1.2.6 (core)",
    "@oclif/plugin-plugins 1.10.10 (core)",
    "@oclif/plugin-update 1.5.0 (core)",
    "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
    "@oclif/plugin-which 1.0.4 (core)",
    "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
    "alias 1.2.0 (core)",
    "apex 0.4.0 (core)",
    "auth 1.8.0 (core)",
    "config 1.3.0 (core)",
    "custom-metadata 1.0.12 (core)",
    "data 0.6.6 (core)",
    "generator 1.2.1 (core)",
    "info 1.1.2 (core)",
    "limits 1.3.0 (core)",
    "org 1.11.0 (core)",
    "salesforce-alm 53.6.0 (core)",
    "schema 1.1.0 (core)",
    "sfdx-cli 7.130.1 (core)",
    "source 1.6.2 (core)",
    "telemetry 1.4.0 (core)",
    "templates 52.6.0 (core)",
    "trust 1.1.0 (core)",
    "user 1.7.0 (core)"
    ],
    "osVersion": "Windows_NT 10.0.19042"
    }

Additional information

@dalden1981 dalden1981 added the investigating We're actively investigating this issue label Dec 15, 2021
@github-actions
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@WillieRuemmele WillieRuemmele added the bug Issue or pull request that identifies or fixes a bug label Dec 16, 2021
@uip-robot-zz
Copy link

This issue has been linked to a new work item: W-10322646

@WillieRuemmele
Copy link
Member

Hi @dalden1981 can you provide an example command used against the dreamhouse-lwc project that will return this error?

@dalden1981
Copy link
Author

dalden1981 commented Dec 17, 2021

@WillieRuemmele ,
To recreate the issue in dreamhouse-lwc:

  1. I added a validation rule. In my case I added "Name_Cannot_Start_with_X" on Account (formula LEFT(Name, 1) = "X").
  2. Then I added an account sfdx force:data:record:create -s Account -v "Name=Test" -u dreamhouse
  3. I noticed that it only happens on update, so I ran sfdx force:data:record:update -s Account -v "Name=Xavier" -u dreamhouse -i 001...

Received error "ERROR running force:data:record:update: Failed to update record with code FIELD_CUSTOM_VALIDATION_EXCEPTION. Fields: []."

FYI, when I ran sfdx force:data:record:create -s Account -v "Name=Xavier" -u dreamhouse I got the error "ERROR running force:data:record:create: Name cannot begin with X"

@WillieRuemmele
Copy link
Member

@maggiben
Copy link
Contributor

maggiben commented Jan 7, 2022

Fixed in sfdx-cli/7.133.0
image

@maggiben maggiben closed this as completed Jan 7, 2022
@shetzel
Copy link
Contributor

shetzel commented Jan 13, 2022

The fix is in the latest CLI release published today. sfdx version 7.133.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests

5 participants