You need to sign in to do that
Don't have an account?
chantspel
Best way to store one unique entry containing user/pass
Hi,
I'm working on a simple data push from salesforce into a custom application. The apex class that will recieve the "trigger" to do the data push needs to retrieve login paramaters, user/pass, to authenticate to our custom app.
What would be the best way/where to store this information. I can build a simple custom object to model the data, but I don't want to have the ability for multiple records to exist. There should be only 1 user/pass combination to be used by my apex class.
Hope this makes sense. Thanks.
You can handle this in two ways:-
1. Handle it at the database level - Have triggers (as validation rules will not serve the purpose) which will prevent user creation if the count of record having a composite key of(Username+ password) greated than 0.
2. You can also take it over to the business logic and have code in your apex class to prevent creation of user with same (username+ password) combination . You can issue a query and the result is greater than zero that means the key exists and the creation of the instance can be skipped.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
You can handle this in two ways:-
1. Handle it at the database level - Have triggers (as validation rules will not serve the purpose) which will prevent user creation if the count of record having a composite key of(Username+ password) greated than 0.
2. You can also take it over to the business logic and have code in your apex class to prevent creation of user with same (username+ password) combination . You can issue a query and the result is greater than zero that means the key exists and the creation of the instance can be skipped.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thank you for your reply. I think the trigger type validation should be sufficient for me needs. Just a quick followup on that. What would be the specific code that prevents the record creation?
For example:
I figured this out. Basically I decided to allow more than one record to exist but have field to mark the primary, and block any new users being created with primary checked. I know I'll need to and a similar rule for updating but this is the gist:
Thats nice .. :)