0

Below is my cmp

<aura:component implements="force:lightningQuickAction" access="global">
<iframe src="sforce.one.navigateToURL('/apex/Letter')" width="100%" height="500px;" frameBorder="0"/>
</aura:component>

Controller for my cmp to get the Letter.Id

({
    myAction : function(Letter, event, helper) {

        window.open("apex/Letter?Id={!Letter__c.Id}","_blank");

    }
})

When I have clcked on the quick action created by me on the object page I got the below error : Uncaught Assertion Failed!: Unable to get value for key 'Letter__c.Id'. No value provider was found for 'Letter__c'. : false Callback failed: aura://ComponentController/ACTION$getComponent

Can anyone help me out with this on where did i go wrong as i'm unable to figure the problem

  • What id are you trying to get if its the sobject letter records id, you can just use the recordid interface and it will give you the recordid attribute with the id value – RedDevil Jul 22 '18 at 15:41
2

I said this before, but I'll say it once more: you cannot use sforce.one.navigateToURL in the src attribute. You cannot run JavaScript in an attribute. You are only ever allowed a reference to a function via {!c.methodName}.

The error specifically mentioned in the question is because there is a standard interface for getting a record Id, called force:hasRecordId. That means your component needs to start off with:

<aura:component implements="force:hasRecordId,force:lightningQuickAction" access="global">

And in your controller:

myAction: function(component, event, helper) {
  var recordId = component.get("v.recordId");
  ...

This is always true, no matter which object you're working with.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy