function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
saurabhkher19saurabhkher19 

Best Approach to Store and Retrieve session information

Hi There,

I am not very old player in Salesforce Integration but I have basic knowledge of Salesforce Integration. For my learning I have creating some methods which gets session information from other salesforce org. For each callout (GET, POST...) I call this method first and then I use the session Information returned.

In one of my previous project, our architect created one integration framework where he was using platform cache to store session information. Is Platform cache is the best way to store session information ?

In some discussion forum, I have seen that not everyone recommend Platform cache to store session information, some suggest to use custom Setting or metadata as well but I don't know exactly how to use them.

Can anyone help me in this direction ? Any code snippet or information link in this direction would be much helpful.

Regards,
Saurabh

AbhishekAbhishek (Salesforce Developers) 
For the Salesforce to Salesforce integration you describe, the best approach is to use Named Credentials (https://help.salesforce.com/articleView?id=named_credentials_about.htm&type=5).

For an example see (https://www.jitendrazaa.com/blog/salesforce/salesforce-to-salesforce-integration-using-named-credentials-in-just-5-lines-of-code/):

Named credentials are more secure and maintainable than platform cache or custom settings/metadata.


I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.