-3

I have a requirement to bring Task and Activites related list in LWC. Based on some conditions this related list will be shown to some users and some users won't see. Can anyone help me with any sample code or guide me on how to start coding for this. I am new to LWC coding.

enter image description here

This is the code that I was trying using a custom object.

<template>
    <lightning-card title='Sample App'>
        <lightning-record-form record id='a010b00000in6e3AAA' 
                    object-api-name='Master_Object__c' 
                    layout-type="Compact" 
                    mode="view"
                    columns="2">
        </lightning-record-form>
    </lightning-card>
</template>

When I used Event object I got an error saying "Object Event is not supported in UI API INVALID_TYPE" I did a search and found out another post saying Standard Event and Task objects are not supported in AURA. I guess the same will be applicable for LWC also.

enter image description here

Here is the URL

2
  • 1
    What have you tried so far? Commented Aug 19, 2019 at 15:41
  • @PranayJaiswal I have updated my comment with sample code which I used.
    – Tamil
    Commented Aug 19, 2019 at 17:35

1 Answer 1

1

If you are simply trying to show a related list based on some condition, Use Related List-Single Component in Lightning App Builder and set the component visibility as per your requirement. It will save you from writing custom component.

Read my blog on it:- SHOWING A RELATED LIST BASED ON USER PROFILE IN LIGHTNING EXPERIENCE

1
  • Hi Sanket kumar, thanks for sharing the answer. My issue is to show the related list based on a formula in the community portal. For now, I am using apex:relatedList tag and rendered attribute to show the list based on the formula. I really appreciate your help. Thanks.
    – Tamil
    Commented Aug 21, 2019 at 18:12

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