You need to sign in to do that
Don't have an account?
avoid hardcoding the username & pswd in the login() method or can we use sessionId instead
Hi All,
Is there a way to avoid hardcoding username & pswd in javscript for the login() method. Im using 21.0 ajax toolkit
var res = sforce.connection.login('username' , 'password');
Coz it becomes difficult to change the user credentials in every environment. I tried to get infor on whether sessionId can be used instead of logging in again, but did not find mush help. Can anyone please throw some light on this.
And if we have to use the login() method, Should we use the system admin credentials? Or should we create a dummy user whose pswd never changes? What is the best way to do it?
Regards,
Sapna
Hi ,
I hope this will help you
sforce.connection.sessionId = '{!$Api.Session_ID}';
Regards
Shashikant Sharma
Hi Shashi,
I believe {!$Api.Session_ID}' can be used in VF pages only. Mine is a javascript on a home page component..
Regards,
Sapna
You could prolly also use Custom Settings to store the Username and Password.
eg
You could create a Custom Settings Object Login_Details__c to store the credentials. (There are two types, List and Hierarchial, both should do - I'd use List)
Login_Details__c.getInstance('Username')
Login_Details__c.getInstance('Password'),