4

So my component has an attribute defined like this:

<aura:attribute name="accountId" type="String" default="" />

that holds the value of a lookup lightning:inputField. I am setting the parameter like so:

createDataExport.setParams({"accountId" : component.get('v.accountId')});

and the backend controller looks like this:

@AuraEnabled
public static String startExport(String accountId) {

and yet I am still getting the error Value provided is invalid for action parameter accountId of type 'String'. I have also tried changing over to type Id but no dice. I've also made sure that the attribute is populating properly, and it is.

Any help is appreciated.

2 Answers 2

6

I figured it out, you need to get the value of the attribute this way because an array proxy is returned by default:

createDataExport.setParams({"accountId" : component.get('v.accountId')[0]});
1

Thanks for the insight. I applied this to LWC.

HTML Code:

<lightning-record-edit-form object-api-name="object_API_name">
<lightning-input-field 
     field-name="field_API_name" 
     value ={value} 
     onchange={handlesearch} 
     field-level-help="Search">
</lightning-input-field>
</lightning-record-edit-form>

JS Code

handlesearch(event){
        this.property = (event.detail.value)[0];
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .