You need to sign in to do that
Don't have an account?
Raksha Narayan
LWC: Iterating list<SObject> from the map<String,list<SObject>> on the html to print the list<SObject> values in table format
I have created a LWC in order to print the sobject data in a table. for that I have created a map<String,list<SObject>>. From the debug logs, i found that the map holds the data in the below format:
mymap{Case=(Case:{Id=5002f0000043zxWAAQ, ContactId=0030c00002kebMSAAY, CaseNumber=00678068}), Event=(Event:{Id=00U2f0000018Ly0EAE, WhoId=0030c00002kebMSAAY, Subject=Test event, Type=Email})}.
Now i need to iterate over the List<Sobject> value to print the values in a table as below.
for case:
idcontactidcase number
5002f0000043zxWAAQ0030c00002kebMSAAY678068
for event:
idsubjecttype
00U2f0000018Ly0EAETest eventEmail
The row and column should be printed in the table dynamically by picking the data from the list<sobject> (no hardcoding of the values in datatable or in html).
Please let me know how this can be achieved
mymap{Case=(Case:{Id=5002f0000043zxWAAQ, ContactId=0030c00002kebMSAAY, CaseNumber=00678068}), Event=(Event:{Id=00U2f0000018Ly0EAE, WhoId=0030c00002kebMSAAY, Subject=Test event, Type=Email})}.
Now i need to iterate over the List<Sobject> value to print the values in a table as below.
for case:
idcontactidcase number
5002f0000043zxWAAQ0030c00002kebMSAAY678068
for event:
idsubjecttype
00U2f0000018Ly0EAETest eventEmail
The row and column should be printed in the table dynamically by picking the data from the list<sobject> (no hardcoding of the values in datatable or in html).
Please let me know how this can be achieved
You can check below post to get complete details.
https://newstechnologystuff.com/2019/04/07/display-generic-sobject-in-lightning-web-components/
In the above link, the html is hardcoded with the field name. i.e.,
<c-lwcs-object key={sobKey.key} sobject={sobKey.value} field-name="Name"></c-lwcs-object>
I do not want to hardcode the field name. instead it should fetch the fields directly from the list<sobject>. Please suggest