I have a salesforce lightning component which uploads an attachment from user's local machine by upload - choose file modal. After we have enabled locker services in our org, its not working and throwing a error on console log as Error "Action.setExclusive is not a function". Please advice!

Thanks in advance.

Regards, Himanshu


2 Answers 2


setExclusive isn't part of the Lightning framework public methods. That means that you may technically use it even it's undocumented, but it could break at any time.

You can search for it in the Lightning Component Developer Guide and see that there is no reference to this method.

Locker Service is ensuring you're only using the public methods of the framework, that's why you have this error, but you should not use it anyway. Let's say it's a good error.

You should just remove this line from your code to make it work. Just test to be sure that there is no performance impact after that.

  • 1
    I would like to add that you can definitely open a dialog with salesforce about opening up this API - please post an idea success.salesforce.com/ideaSearch and then add a link to it here. Feb 9, 2017 at 12:07

As Fabien Taillon mentioned, Action.setExclusive() isn't supported in Lightning. You can see the Javascript API for Action at https://[myDomain].lightning.force.com/auradocs/reference.app#reference?topic=api:Action.

The open source Aura project marked Action.setExclusive() as deprecated in February 2016. The git commit is at https://github.com/forcedotcom/aura/commit/7a427f58b9f15959ce249e3771ed0b524beb4fb0#diff-f4cefc795056979e57fe288ca244894aR980. Again this API was never exposed in Lightning.

If your concern is that the upload may take a long time (eg supported file sizes are large) then consider using Action.setBackground(). That'll cause the action to not be boxcar'ed with other non-background actions which drive your UI.

There has been discussion internally about exposing additional APIs to express semantics of actions. Eg priority, fast vs slow actions. This is not on any roadmap yet. If you have an opinion or use case you'd like us to consider please post it at https://success.salesforce.com/ideaSearch.

You must log in to answer this question.

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