I'm trying to run a simple update action on a record that I queried initially using a wired method. After prepare the recordInput object I get this error:

  "error": {
    "ok": false,
    "status": 400,
    "statusText": "Bad Request",
    "body": {
      "message": "Must provide at least one of the parameters - 'fields', 'layoutTypes', 'optionalFields'.",
      "statusCode": 400,

This is how my call looks like:

        var customSettingRecordId = '';

        //loop over records coming from controller
        this.customsettingFromQuery.forEach(function(element) {
            if(element.Name === 'TEST-EMORAN'){
                console.log('ASSIGNING VALUE');                
                customSettingRecordId = element.Id;

        // === FIELDS ====
        const fields = {};
        fields[CUSTOM_SETTING_ID.fieldApiName] = customSettingRecordId;
        fields[SEND_LOCATION_EVERY.fieldApiName] = this.sendEvery;
        fields[NAME.fieldApiName] = 'TEST-EMORAN';

        const recordInput = { fields };
        recordInput.fields = fields;


            .then(() => {
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Record Is Updated',
                        variant: 'sucess',
            .catch(error => {
                console.log('error' + JSON.stringify(error, null, 2));


the content of the input record looks like this:


Is anything I'm missing here?



Below details are applicable based on this assumption (and based on results of a quick test that I performed) that you are trying to update a custom setting record.

I started by verifying that Custom Settings are supported by UI-API which forms the base of the updateRecord() function, and it does. Then I tried updating a custom setting record from POSTMAN and it worked fine. Then I tried to update the same record from a LWC utilizing this function, and ended up with the same error that you are receiving.

It seems this is a bug while making an update on a Custom Setting record from a LWC. Even if the updateRecord() call returned an error response, the custom setting record actually got updated.

This definitely needs to be opened as a case to Salesforce Support.

| improve this answer | |
  • I think it has to do more with security, custom settings are config records and not normal records. An lwc component cant be hosted in public site /community and a guest user can update(via JS hacks) them which might not always be safe and secure. – Pranay Jaiswal Mar 27 '19 at 9:25
  • @PranayJaiswal could be true and ideally it should be a consistent behavior either allow or don’t. But I could see as noted in the details that the response suggests the update failed but the record was on the other hand updated successfully. – Jayant Das Mar 27 '19 at 12:14
  • 1
    Thanks @JayantDas I will create a support ticket, as you mentioned the Custom Setting gets updated correctly even the error shows in the console, good catch – Yucel Apr 3 '19 at 14:03
  • @Edgar Please do let this thread know what you hear back from the support team. Once you get the details, it will be good to know if this is a bug or should not have been allowed at first place. – Jayant Das Apr 3 '19 at 14:04

I think you need to get rid of this line:

recordInput.fields = fields;

That line is not there if you check out the documentation: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.reference_update_record

I was able to get updateRecord to work using the documentation as an example.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.