[Cannot read property 'setParams' of null]Lightning Event Modelerror Cannot read property 'setParams' of...
LM324 - Issue with output in negative feedback
How do we know neutrons have no charge?
Where to find the Arxiv endorsement code?
Speed and Velocity in Russian
What makes learning more difficult as we age?
Another student has been assigned the same MSc thesis as mine (and already defended)
What are examples of EU policies that are beneficial for one EU country, disadvantagious for another?
Garage door sticks on a bolt
A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?
Which altitudes are safest for VFR?
Can RPi4 run simultaneously on dual band (WiFi 2.4GHz / 5GHz)?
Why Italian monolingual dictionaries usually take complex/archaic examples from books instead of creating simple examples?
What should I consider when deciding whether to delay an exam?
Why do some modern glider wings like the Schleicher 29 have a tadpole shape rather than a teardrop shape?
Is there a list of world wide upcoming space events on the web?
Can a passenger predict that an airline is about to go bankrupt?
How much horsepower to weight is required for a 1:1 thrust ratio
As a team leader is it appropriate to bring in fundraiser candy?
GPLv3 forces us to make code available, but to who?
How can the dynamic linker/loader itself be dynamically linked as reported by `file`?
Does the app TikTok violate trademark?
Would an object shot from earth fall into the sun?
Is there a relationship between prime numbers and music?
What does it mean by "my days-of-the-week underwear only go to Thursday" in this context?
[Cannot read property 'setParams' of null]
Lightning Event Modelerror Cannot read property 'setParams' of undefined - lightning componentError in $A.getCallback() [Cannot read property 'setParams' of undefined]Error Implementing force:showToast - Cannot read property 'setParams' of undefinede.force:navigateToURL: [Cannot read property 'setParams' of undefined]save two records in two objects with a single save button with lightning componentsCannot read property 'setParams' of nullCreate and Navigate to an Account record Detail Page
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child component with help of Events. But getting the error
"Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read
property 'setParams' of null] Failing descriptor:
{c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.
Here is the code.
ChildToParentEvent.evt:-
<aura:event type="COMPONENT">
<aura:attribute type="String" name="firstName"/>
<aura:attribute type="String" name="lastName"/>
<aura:attribute type="String" name="Phone"/>
</aura:event>
MySampleChildCmp:-
<aura:component>
<!--<aura:attribute type="String" name="userData" default=""/>
<aura:attribute type="String" name="firstName" default=""/>
<aura:attribute type="String" name="lastname" default=""/>
<aura:attribute name="Phone" type="Integer" default=""/>-->
<aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
<lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>
MySampleChildCmpController:-
({
handleClick : function(component, event, helper) {
alert('called Child component');
var evt = component.getEvent("c.ChildToParentEvnt");
evt.setParams({'firstName' : SFDC,
'lastName' : Developer,
'Phone' : 9999999
});
evt.fire();
alert('called Event');
}
})
MySampleParentCmp:-
<aura:component >
<aura:attribute type="String" name="userData" default="" />
<aura:attribute type="String" name="firstName" default="ABC" />
<aura:attribute type="String" name="lastName" default="DEF" />
<aura:attribute type="Integer" name="Phone" default="" />
<aura:attribute type="boolean" name="callChild" default="false" />
<aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
<div>
<c:MySampleChildCmp />
</div>
<div>
<h2>User Data from Event </h2>
Name : {!firstName} {!lastName}<br/><br/>
Phone : {!Phone}
</div>
</aura:component>
MySampleParentController:-
({
handleClick : function(component, event, helper) {
alert('Called Parent');
var lastName= event.getParam('lastName');
var firstName= event.getParam('firstName');
var Phone= event.getParam('Phone');
component.set('v.lastName', lastName);
component.set('v.firstName', firstName);
component.set('v.phone', Phone);
}
})
lightning-aura-components
add a comment
|
Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child component with help of Events. But getting the error
"Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read
property 'setParams' of null] Failing descriptor:
{c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.
Here is the code.
ChildToParentEvent.evt:-
<aura:event type="COMPONENT">
<aura:attribute type="String" name="firstName"/>
<aura:attribute type="String" name="lastName"/>
<aura:attribute type="String" name="Phone"/>
</aura:event>
MySampleChildCmp:-
<aura:component>
<!--<aura:attribute type="String" name="userData" default=""/>
<aura:attribute type="String" name="firstName" default=""/>
<aura:attribute type="String" name="lastname" default=""/>
<aura:attribute name="Phone" type="Integer" default=""/>-->
<aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
<lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>
MySampleChildCmpController:-
({
handleClick : function(component, event, helper) {
alert('called Child component');
var evt = component.getEvent("c.ChildToParentEvnt");
evt.setParams({'firstName' : SFDC,
'lastName' : Developer,
'Phone' : 9999999
});
evt.fire();
alert('called Event');
}
})
MySampleParentCmp:-
<aura:component >
<aura:attribute type="String" name="userData" default="" />
<aura:attribute type="String" name="firstName" default="ABC" />
<aura:attribute type="String" name="lastName" default="DEF" />
<aura:attribute type="Integer" name="Phone" default="" />
<aura:attribute type="boolean" name="callChild" default="false" />
<aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
<div>
<c:MySampleChildCmp />
</div>
<div>
<h2>User Data from Event </h2>
Name : {!firstName} {!lastName}<br/><br/>
Phone : {!Phone}
</div>
</aura:component>
MySampleParentController:-
({
handleClick : function(component, event, helper) {
alert('Called Parent');
var lastName= event.getParam('lastName');
var firstName= event.getParam('firstName');
var Phone= event.getParam('Phone');
component.set('v.lastName', lastName);
component.set('v.firstName', firstName);
component.set('v.phone', Phone);
}
})
lightning-aura-components
Kindly format the code while asking question.
– salesforce-sas
9 hours ago
add a comment
|
Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child component with help of Events. But getting the error
"Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read
property 'setParams' of null] Failing descriptor:
{c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.
Here is the code.
ChildToParentEvent.evt:-
<aura:event type="COMPONENT">
<aura:attribute type="String" name="firstName"/>
<aura:attribute type="String" name="lastName"/>
<aura:attribute type="String" name="Phone"/>
</aura:event>
MySampleChildCmp:-
<aura:component>
<!--<aura:attribute type="String" name="userData" default=""/>
<aura:attribute type="String" name="firstName" default=""/>
<aura:attribute type="String" name="lastname" default=""/>
<aura:attribute name="Phone" type="Integer" default=""/>-->
<aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
<lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>
MySampleChildCmpController:-
({
handleClick : function(component, event, helper) {
alert('called Child component');
var evt = component.getEvent("c.ChildToParentEvnt");
evt.setParams({'firstName' : SFDC,
'lastName' : Developer,
'Phone' : 9999999
});
evt.fire();
alert('called Event');
}
})
MySampleParentCmp:-
<aura:component >
<aura:attribute type="String" name="userData" default="" />
<aura:attribute type="String" name="firstName" default="ABC" />
<aura:attribute type="String" name="lastName" default="DEF" />
<aura:attribute type="Integer" name="Phone" default="" />
<aura:attribute type="boolean" name="callChild" default="false" />
<aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
<div>
<c:MySampleChildCmp />
</div>
<div>
<h2>User Data from Event </h2>
Name : {!firstName} {!lastName}<br/><br/>
Phone : {!Phone}
</div>
</aura:component>
MySampleParentController:-
({
handleClick : function(component, event, helper) {
alert('Called Parent');
var lastName= event.getParam('lastName');
var firstName= event.getParam('firstName');
var Phone= event.getParam('Phone');
component.set('v.lastName', lastName);
component.set('v.firstName', firstName);
component.set('v.phone', Phone);
}
})
lightning-aura-components
Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child component with help of Events. But getting the error
"Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read
property 'setParams' of null] Failing descriptor:
{c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.
Here is the code.
ChildToParentEvent.evt:-
<aura:event type="COMPONENT">
<aura:attribute type="String" name="firstName"/>
<aura:attribute type="String" name="lastName"/>
<aura:attribute type="String" name="Phone"/>
</aura:event>
MySampleChildCmp:-
<aura:component>
<!--<aura:attribute type="String" name="userData" default=""/>
<aura:attribute type="String" name="firstName" default=""/>
<aura:attribute type="String" name="lastname" default=""/>
<aura:attribute name="Phone" type="Integer" default=""/>-->
<aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
<lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>
MySampleChildCmpController:-
({
handleClick : function(component, event, helper) {
alert('called Child component');
var evt = component.getEvent("c.ChildToParentEvnt");
evt.setParams({'firstName' : SFDC,
'lastName' : Developer,
'Phone' : 9999999
});
evt.fire();
alert('called Event');
}
})
MySampleParentCmp:-
<aura:component >
<aura:attribute type="String" name="userData" default="" />
<aura:attribute type="String" name="firstName" default="ABC" />
<aura:attribute type="String" name="lastName" default="DEF" />
<aura:attribute type="Integer" name="Phone" default="" />
<aura:attribute type="boolean" name="callChild" default="false" />
<aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
<div>
<c:MySampleChildCmp />
</div>
<div>
<h2>User Data from Event </h2>
Name : {!firstName} {!lastName}<br/><br/>
Phone : {!Phone}
</div>
</aura:component>
MySampleParentController:-
({
handleClick : function(component, event, helper) {
alert('Called Parent');
var lastName= event.getParam('lastName');
var firstName= event.getParam('firstName');
var Phone= event.getParam('Phone');
component.set('v.lastName', lastName);
component.set('v.firstName', firstName);
component.set('v.phone', Phone);
}
})
lightning-aura-components
lightning-aura-components
edited 9 hours ago
salesforce-sas
11k1 gold badge3 silver badges28 bronze badges
11k1 gold badge3 silver badges28 bronze badges
asked 9 hours ago
RagavendraRagavendra
132 bronze badges
132 bronze badges
Kindly format the code while asking question.
– salesforce-sas
9 hours ago
add a comment
|
Kindly format the code while asking question.
– salesforce-sas
9 hours ago
Kindly format the code while asking question.
– salesforce-sas
9 hours ago
Kindly format the code while asking question.
– salesforce-sas
9 hours ago
add a comment
|
1 Answer
1
active
oldest
votes
Refer to this example. You are facing issue because of line component.getEvent("c.ChildToParentEvnt")
.
For getting view its v.
and for getting controller method or apex method its c.
BUT for getting event, you DO NOT have to use binder. Change the line to:
component.getEvent("ChildToParentEvnt")
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
add a comment
|
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f279100%2fcannot-read-property-setparams-of-null%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Refer to this example. You are facing issue because of line component.getEvent("c.ChildToParentEvnt")
.
For getting view its v.
and for getting controller method or apex method its c.
BUT for getting event, you DO NOT have to use binder. Change the line to:
component.getEvent("ChildToParentEvnt")
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
add a comment
|
Refer to this example. You are facing issue because of line component.getEvent("c.ChildToParentEvnt")
.
For getting view its v.
and for getting controller method or apex method its c.
BUT for getting event, you DO NOT have to use binder. Change the line to:
component.getEvent("ChildToParentEvnt")
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
add a comment
|
Refer to this example. You are facing issue because of line component.getEvent("c.ChildToParentEvnt")
.
For getting view its v.
and for getting controller method or apex method its c.
BUT for getting event, you DO NOT have to use binder. Change the line to:
component.getEvent("ChildToParentEvnt")
Refer to this example. You are facing issue because of line component.getEvent("c.ChildToParentEvnt")
.
For getting view its v.
and for getting controller method or apex method its c.
BUT for getting event, you DO NOT have to use binder. Change the line to:
component.getEvent("ChildToParentEvnt")
answered 9 hours ago
salesforce-sassalesforce-sas
11k1 gold badge3 silver badges28 bronze badges
11k1 gold badge3 silver badges28 bronze badges
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
add a comment
|
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
Thanks peter, Now its working as expected
– Ragavendra
8 hours ago
add a comment
|
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f279100%2fcannot-read-property-setparams-of-null%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Kindly format the code while asking question.
– salesforce-sas
9 hours ago