2
<lightning-helptext class="customIcon" content={helpText}></lightning-helptext>

How to fetch help text of a specific field in JS as we do in apex/VF using

$ObjectType.OpportunityLineItem.Fields.Sale_Role__c.inlineHelpText (for e.g.).

1 Answer 1

4

You can get all info about a object and its fields, child-relationships, named-fields etc through getObjectInfo wire service.

Below is example:

JS:

import { LightningElement, wire, track } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';

export default class Example extends LightningElement {
    @track fieldsInfo;
    @wire(getObjectInfo, { objectApiName: ACCOUNT_OBJECT })
    getAccountInfo(result) {
        if (result.data)
            this.fieldsInfo = result.data.fields;
        console.log(JSON.stringify(result));
    }
}

HTML:

<template>
    <template if:true={fieldsInfo}>
        Active help text - {fieldsInfo.Active__c.inlineHelpText}
    </template>
</template>

You must log in to answer this question.

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