Data Registry

The Data Registry is your FEF application's data source. All data within your FEF application is available as part of the Data Registry. The DataRegistry can contain objects that are of type Facade.Prototypes.Data or Facade.Prototypes.DataList. See the prototypes FEF Concepts page for more description on data prototypes in FEF.

Here is a list and explanation of data that is always in the Data Registry once a FEF application loads. Listed below are the keys of the corresponding data within the data registry, so each piece of data can be fetched within your behavior js file by inserting the key into the following method call:

var data = Facade.DataRegistry.get('<key>');
Key Explanation
$currentUser The current user that is using the FEF application. It is considered best practice to use Facade.Globals.userId. However this is not available in earlier versions of FEF.
$currentOrg The current organization that is using the FEF application. It is considered best practice to user Facade.Globals.orgId, however this may not be available in earlier versions of FEF.
$ActionHistory Your primary data's action history.
Accessible Methods

Here, we list the common methods available to the FEF Developer from the Data Registry entry point of the Facade.

Register Data in Registry

Data can be programmatically added to the Data Registry by using its register function. The register method takes two parameters : the first is the key to save that data in the data store and the second is the data value. When you register data, be sure to include the design type of the new data when initializing your data. Data within the Data Registry is wrapped in a data prototype or datalist prototype

//Register singular data in data registry
var rawDataObject = {
    fieldA : 'someVal' ,
    fieldB : 'otherVal'
}
Facade.DataRegistry.register('myData' , new Facade.Prototypes.Data(rawDataObject, { type : 'MyCustomDataType' }));
//Register an empty datalist
var dataList = Facade.DataRegistry.register('myDataList' , new Facade.Prototypes.DataList([] , { type : 'MyListData' }));
//Add a piece of data to your DataList
dataList.pushResult( new Facade.Prototpyes.Data(rawDataObject) );

Get Data from Data Registry

Use the Data Registry's get method to get stored data by its corresponding key.

var data = Facade.DataRegistry.get('myData');

Remove Data from Data Registry

To remove an index from the DataRegistry, use the deregister() method.
//Clear data 'myData' from DataRegistry
Facade.DataRegistry.deregister('myData');

Get Loaded Root

When a root is fetched from the server, it is automatically registered in the DataRegistry using the key TYPE.UID
//A part of the program loads a root
Facade.Resolver.find('CortDesignA', '1212'); // returns a promise as we contact server
//Lookup this root during FEF runtime
let myRoot = Facade.DataRegistry.get('CortDesignA.1212');