[SalesForce] Value provided is invalid for action parameter [String param] of type ‘String’

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.

Best Answer

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]});