• Daniel Velez 8
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

I have a list of instances of an Apex Class (see the picture)apex class

I am able to show that list in a component (LWC) by using imperative apex calls, but if I pass that list to a child component (LWC) in the child component the javascript shows undefined. It means I can not share a list of instances of an apex class from parent to child.

pcEntryAndOppLine is my variable with the list of instances,

If I do in the parent component javascript this:

this.temp = JSON.parse(JSON.stringify(this.pcEntryAndOppLine));
 

and I share temp instead of pcEntryAndOppLine, then the child LWC will receive the list and will be able to print it in a for loop (I dont know why, I you can help me to understand this also I will appreciate it!)

But if I use that list in the child component inside a for loop that contains another small component (for showing each element of the list) the javascript shows an undefined error, for example when getting the property ".Name".

How Can I have that variable working as another one (I am sharing the record Id and other variables and it works as expected.)

If you need more info please ask for it, thanks in advance.

Hello all.

I have this js in a LWC

 

import { LightningElement, api, wire } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import SUPERVISOR_FIELD from '@salesforce/schema/Bear__c.Supervisor__c';
const bearFields = [SUPERVISOR_FIELD];
export default class BearSupervisor extends LightningElement {
	@api recordId; // Bear Id
	@wire(getRecord, { recordId: '$recordId', fields: bearFields })
	bear;
	get supervisorId() {
		return getFieldValue(this.bear.data, SUPERVISOR_FIELD);
    }
    
}


how is this code retrieving the recordId? why it is inside single quotes (' '). I know that the "$" makes it reactive. 

Is recordId a special word in salesforce/javascript?

recordId is enver defined in the html
 

<template>
	<lightning-card title="Supervisor" icon-name="standard:people">
		<div class="slds-m-around_medium">
			<!-- Show supervisor when bear is loaded -->
			<template if:true={bear.data}>
				<lightning-record-form
					object-api-name="Contact"
					record-id={supervisorId}
					layout-type="Compact">
                </lightning-record-form>
			</template>
			<!-- Data failed to load -->
			<template if:true={bear.error}>
				<div class="slds-text-color_error">
					An error occurred while loading the bear record
				</div>
			</template>
		</div>
	</lightning-card>
</template>
this is the configuration file in case you need it 
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="bearSupervisor">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>
<targets>
	<target>lightning__RecordPage</target>
</targets>
<targetConfigs>
	<targetConfig targets="lightning__RecordPage">
		<objects>
			<object>Bear__c</object>
		</objects>
	</targetConfig>
</targetConfigs>
</LightningComponentBundle>
 

I was looking for documentation about this but I can not fin anything.

I will apreciate any documentation or any comment, I can not understand why this works.

Hi, 
I just can't seem to get pass stage 10, as I keep getting, the below error:
"The View Lightning Campaign Influence Report link on the Campaign object must use a relative URL and dynamic filter values."
I have tried with different trail orgs and same issue persists.  Has anyone tried this challenge recently and do you have this issue?

The link in the button I have is "/one/one.app#/sObject/00O0N000004ti60/view?fv0={!Campaign.Id}" - the ID of the report is correct and when clicked from campaign it filters correctly.
Screenshot:
Campaign report link