Data Store

In 200 OK, the Datastore, also known as Platform Cache, functions as a specialized storage area for frequently accessed data within your 200 OK application. It works like a super-fast memory system for 200 OK, making data easy to grab when needed.

Example :-

You are bringing data from one ERP, the account receivables from a customer every night. We are not interested to store all the data in Salesforce, rather, the data needs to be passed in another job which is going to execute after one hour to send to another system for reporting purpose. So, Salesforce provides a Platform Cache where you can keep the data for certain period of time. Once the data has been retrieved or read, it can automatically disappear or you can still keep it for other purposes by specifying the time to live.

How to create and use the Data Store in the 200 OK.

We have to enable the platform cache in the org.

To enable Platform Cache:

  1. Click on the setup gear icon at the top right corner.

  2. Go to the Home tab.

  3. Use the quick find feature to search for 'Platform Cache'.

In the Platform Cache, you'll find a label called '200 OK' and the allocated capacity is currently set to 0.

Click on the edit and change the allocated capacity to "3" in the Organization field under the section of Org Cache Allocation and save it.

Create the Integration Channel by providing the required details click on the Action tab next to the Integration.

On click the Action we can see Add New Action click on that it will show the list of actions .

Select the Data Store action form the list.

Label the Data Store as required and provide the data in the field and value which you want to store.

Once the data is passed in key-value format. Click on save and execute the channel. The Data will be saved for temporary storage in the platform cache.

We are also providing time to live (TTL) feature in data store. Using this feature, the user can store the data for given time frame after that data will cleared from data store.

To set up the TTL click on the Advance Settings and provide the value in the TTL and save the advance settings.

How to get the Stored Value.

To get the stored data we have one function called getDataStoreValue. By using this function we can get the data and use it as we required.

User can also provide TTL in getDataStoreValue function. getDataStoreValue has one required parameter and one optional parameter.

The first parameter is key which is required for this function and the second parameter is TTL value which is optional.

Users can provide TTL value in seconds. The minimum TTL value is 300 if third parameter is empty then. After getting the data it will deleted automatically.

Note: - This feature is designed for handling small data sizes, so please refrain from storing large JSON datasets.

By this we are concluding how to store and retrieve data with ease.

Last updated