function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vleandrovleandro 

Expose Case Record Type in a Lightning Web Component

We have multiple Record Types on the Case object.  We also have folks who work across Record Types (they're not just tied to a single Record Type).

I tried writing a Lightning Web Component to bubble up the Record Type name so Staff know if they're working with a record that is RecordType1, RecordType2, or RecordType3.

While I can pull other pieces of data from the Case object (such as Case Number, and Contact), I can't seem to expose the name of the Record type.  Any ideas?  I'm pretty new to development so I've been trying to cobble something together and would appreciate any insight / thoughts and help!

Here's my code snippets.

recordTypeForCase.js
import { LightningElement, api } from 'lwc';

export default class HelixITSMType extends LightningElement {
    @api recordId; // Case Id
}

RecordTypeForCase.html​​​​​​​
<template>
    <lightning-card class="slds-text-title_bold" title="Record Type" icon-name="standard-people">
        <div class="slds-m-around_medium">
        <!-- Show Helix ITSM Record Type when Case is loaded -->
            <lightning-record-view-form record-id={recordId} object-api-name="Case">
                <div class="slds-grig">
                    <div class="slds-col slds-size_1-of-2">
                        <lightning-output-field field-name="CaseNumber"></lightning-output-field>
                        <lightning-output-field field-name="RecordTypeId"></lightning-output-field>
                        <lightning-output-field field-name="ContactId"></lightning-output-field>
                    </div>
                </div>
            </lightning-record-view-form>
        </div>
     </lightning-card>   
</template>

Thank you in advance for your help and advice.  

Virginia
Sarah Smith 15Sarah Smith 15
Same question, 2 years later...any suggestions?
Virginia Leandro 27Virginia Leandro 27
I came across this.  I think this is the right course.

https://salesforce.stackexchange.com/questions/298693/how-do-you-fetch-a-record-type-id-in-a-lightning-web-component-using-the-develop