You need to sign in to do that
Don't have an account?
Dustin Moore 22
LWC Show/Hide in Lightening Community based on Account Record Type
Hello,
I have a custom LWC built primarly for use in a lightening community. I need to find the correct attribute to show/hide this component based on a record type of the Account Object.
Record Types:
Household: Hide
Office: Show
State Office: Show
Additionally, I need to be able to show/hide the options in based on the record types
Record Types Show Options:
HouseHold: N/A component not shown on page
Office: Show Option 1 and 2
State Office: Show options 3 and 4
Please see the code below, and any help would be greatly appericated!
XML:
HTML:
I have a custom LWC built primarly for use in a lightening community. I need to find the correct attribute to show/hide this component based on a record type of the Account Object.
Record Types:
Household: Hide
Office: Show
State Office: Show
Additionally, I need to be able to show/hide the options in based on the record types
Record Types Show Options:
HouseHold: N/A component not shown on page
Office: Show Option 1 and 2
State Office: Show options 3 and 4
Please see the code below, and any help would be greatly appericated!
XML:
<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="DocGenSelector"> <apiVersion>46.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightningCommunity__Page</target> </targets> </LightningComponentBundle>
HTML:
<template> <div style="position:relative;" class="wrapper"> Select a report: <select class="doc-gen-selector"> <option value="eyJhY3Rpb25JZCI6ImEwMDM2MDAwMDBQYmgwTUFBUiIsImxpbmtGaWVsZElkIjoiSWQifQ==">VOCA Office Last Quarter</option> <option value="eyJhY3Rpb25JZCI6ImEwMDFSMDAwMDBkbE1KU1FBMiIsImxpbmtGaWVsZElkIjoiSWQifQ==">MVS Office YTD</option> <option value="eyJhY3Rpb25JZCI6ImEwMDFSMDAwMDBkbE1KU1FBMiIsImxpbmtGaWVsZElkIjoiSWQifQ==">VOCA State Last Quarter</option> <option value="eyJhY3Rpb25JZCI6ImEwMDFSMDAwMDBkbE1KU1FBMiIsImxpbmtGaWVsZElkIjoiSWQifQ==">MVS State YTD</option> </select> <button title="Run the selected action" type="button" class="slds-button slds-button_brand" style="margin-left: 1rem" onclick={runButtonClicked}>Run</button> <div class="popup"> <button class="close-popup" onclick={closePopup}>×</button> <div class="popup-body"> <iframe class="iframe"></iframe> </div> </div> </div> </template>
Refer this link for getting record id: https://developer.salesforce.com/docs/component-library/documentation/lwc/use_record_context
Refer this link for UI API: https://developer.salesforce.com/docs/component-library/documentation/lwc/use_record_context