2

In the detail page below, the standard Knowledge component is properly refreshed when I change the "Verbatim (English Language)" field through the UI.

enter image description here

However, if I change the value of "Verbatim (English Language)" field using Lightning Data Services the Knowledge component is not refreshed.

Does anybody knows how to have the Knowledge component refreshed when Case record fields are changed programatically?

Below is the source code I am using to change the "English Verbatim" field value. It's API name is actually Subject, the default Case field.

import { LightningElement, api } from 'lwc';
import { updateRecord } from 'lightning/uiRecordApi';
import CASE_ID_FIELD from '@salesforce/schema/Case.Id';
import CASE_SUBJECT from '@salesforce/schema/Case.Subject';

export default class CustomKnowledge extends LightningElement
{
    @api recordId;

    handleAddVerbatimClick()
    {
        updateRecord(this.getRecordInput('Knowledge Article'));
    }

    handleRemoveVerbatimClick()
    {
        updateRecord(this.getRecordInput(''));
    }

    getRecordInput(subject)
    {
        return {
            fields: {
                [CASE_ID_FIELD.fieldApiName]: this.recordId,
                [CASE_SUBJECT.fieldApiName]: subject
            }
        }
    }
}

Your Answer

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

Browse other questions tagged or ask your own question.