You need to sign in to do that
Don't have an account?
Need to be able to store password for an outside web service
Hello all,
I'm building an application that needs to authenticate against a non-Salesforce web service. I want the user to be able to configure the username and password for the website the first time the application runs, then be able to go back and update them later if they change. I also don't want the user to have to do anything other than install the app.
Unfortunately, I can't find a way to do this in Salesforce via Apex - there just doesn't seem to be a way to make data persist that doesn't fit into the standard Salesforce data model. I've thought of using Custom Settings for this, but it looks like that won't work - there are no methods to create or set custom settings in Apex that I can find, and these custom settings are shared across organizations - which obviously won't work for password storage.
If anyone has any suggestions, they would be most appreciated.
CustomSettings seem quite a good fit, you are able to set / retrieve values - I wrote a little blog post about this
http://cloudnow.wordpress.com/2011/04/20/custom-settings-how-and-why/
About sharing, I believe you can declare a CustomSetting to be Protected rather than Public, that should restrict access.
The other alternative is to create an Object, which then holds your authentication data.
All Answers
CustomSettings seem quite a good fit, you are able to set / retrieve values - I wrote a little blog post about this
http://cloudnow.wordpress.com/2011/04/20/custom-settings-how-and-why/
About sharing, I believe you can declare a CustomSetting to be Protected rather than Public, that should restrict access.
The other alternative is to create an Object, which then holds your authentication data.
That's a great blog entry, and it answers almost all of my questions! Thank you!
One thing I'm not sure on - can I package custom settings into my application, or does the user have to define them after installing my app in order for this to work?
yes they are packageable. i can vouch for unmanaged packages personally! the data stored cannot be packaged of course, like anyother sobject
Thank you so much for your help, Ritesh! This was great information.