You need to sign in to do that
Don't have an account?

how to resolve undefined assignment in helper.js
I have a apex class which is having one method with returntype wrapper class. i am binding the return type in helper in a response attribute (type is object). I want to fetch two variables i.e. id,status from response. Currently I am getting undefined error in output.
Reponse attribute in cmp:
<aura:attribute name="response" type="object"/>
Helper.js:
({ getStatusHelper : function(component, event,helper) {
var jobID = event.getParam("Pass_Result");
component.set("v.jobId", jobID); var action = component.get("c.getCalloutResponseStatus"); action.setParams({"jobId": jobID});
action.setCallback(this, function(response) { var state = response.getState();
if (component.isValid() && state === "SUCCESS") { component.set("v.response", response.getReturnValue());
**var getStatus = component.get("v.response").status; //GETTING UNDEFINED ERROR
var getJobId = component.get("v.response").id; //GETTING UNDEFINED ERROR**
}
else{ alert('Failed status call from child!!'); } }); $A.enqueueAction(action); }
})
can anyone pls help me on this issue
Reponse attribute in cmp:
<aura:attribute name="response" type="object"/>
Helper.js:
({ getStatusHelper : function(component, event,helper) {
var jobID = event.getParam("Pass_Result");
component.set("v.jobId", jobID); var action = component.get("c.getCalloutResponseStatus"); action.setParams({"jobId": jobID});
action.setCallback(this, function(response) { var state = response.getState();
if (component.isValid() && state === "SUCCESS") { component.set("v.response", response.getReturnValue());
**var getStatus = component.get("v.response").status; //GETTING UNDEFINED ERROR
var getJobId = component.get("v.response").id; //GETTING UNDEFINED ERROR**
}
else{ alert('Failed status call from child!!'); } }); $A.enqueueAction(action); }
})
can anyone pls help me on this issue
You can also validate if you are getting the information properly using console.log(response.getReturnValue());
If it helps please like and mark the comment as correct so the question is closed and it can help others with similar issues.
All Answers
I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. For Some Useful Printer Related Information anyone can visit us.
You can also validate if you are getting the information properly using console.log(response.getReturnValue());
If it helps please like and mark the comment as correct so the question is closed and it can help others with similar issues.