You need to sign in to do that
Don't have an account?
CARLOS RODRIGO DEL TORO ORTIZ
custom field no show in lwc
I'm trying to pass a list of assets to the lwc from the controller but when reviewing the data, only the values of the standard fields are arriving, the custom fields do not appear
This is my controller
This is my carouselBanner.js
the query has this data
In the console.log only show me the error
Error: [LWC error]: Invalid template iteration for value "undefined" in [object:vm undefined (12)]. It must be an Array or an iterable Object
and it only shows the values of the fields ID and NAME which are standard fields of the object
but custom fields Activo__c,Audiciencias__c,url__c not appear , and i do not why
This is my controller
public with sharing class CarouselBannerController { @AuraEnabled(cacheable=true) public static List<Asset> getBanners() { List<Asset> ls = [ SELECT ID,Name,Activo__c,Audiciencias__c,url__c FROM Asset ORDER BY Name ]; Map<Id, Asset> m = new Map<Id, Asset>(ls); return ls; } }
This is my carouselBanner.js
import { LightningElement,track,wire } from 'lwc'; import getBanners from '@salesforce/apex/CarouselBannerController.getBanners'; export default class CarouselBanner extends LightningElement { bannerResult; error; @wire(getBanners) wireBanners({error,data}){ if(data){ this.bannerResult = data; detail : this.bannerResult; console.log("resultado" + JSON.stringify(this.bannerResult)) }else if (error){ this.error = error; this.bannerResult = undefined; } } }
the query has this data
| ID | NAME | ACTIVO__C | AUDICIENCIAS__C | URL__C |:------------------ | :-------- |:--------- |:--------------------- | ---------- | 02i19000003f5H0AAI | Banner1 | false | Brasil;Chile;Colombia |www.google.com | 02i19000003f46yAAA | Banner2 | true | Argentina |https://player.vimeo.com/video/241135386 | 02i19000003f56wAAA | Banner3 | true | Colombia;Ecuador |www.google.com
In the console.log only show me the error
Error: [LWC error]: Invalid template iteration for value "undefined" in [object:vm undefined (12)]. It must be an Array or an iterable Object
and it only shows the values of the fields ID and NAME which are standard fields of the object
resultado[ {"Name":"Banner1","Id":"02i19000003f5H0AAI"}, {"Name":"Banner2","Id":"02i19000003f46yAAA"}, {"Name":"Banner3","Id":"02i19000003f56wAAA"} ]
but custom fields Activo__c,Audiciencias__c,url__c not appear , and i do not why
Why you are uing the below line in JS is it needed ?
detail : this.bannerResult;
Can you please remove the above line and try also post your entire code HTML. JS, Apex.
Thanks,
Maharajan.C