How to use $A.set() or how to add a custom global value provider?

I am a little bit confused. Knowing that not all features which are available in a pure aura project are exposed to Lightning Components I thought it is mandatory to check against the Salesforce developer documentation.

So in the auradocs/ below the JavaScript API section I found the function $A.set() giving this example:

$A.set("$Custom.something","new Value")

Unfortunately this does not work, giving me an error “Unable to set value for key”. So my assumption is that I have to define a global value provider with the appropriate key first. When you search the Salesforce developer documentation against global value provider you get the first result showing up:

It seems that the search result is not within the scope of the Lightning Components as it does not show up in the navigation.

Does anyone have an idea how

  • $A.set() is working
  • I can add a custom global value provider or any other mechanism to store data in a manner known as Singleton

Thanks in advance



$A.set() isn’t exposed in Lightning Experience.

You can check this blog post re: client-side shared singleton (across components):

Source : Link , Question Author : Christian Menzinger , Answer Author : muenzpraeger

Leave a Comment