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
ManojjenaManojjena 

INVALID_SESSION_ID: Login failed Session not found, missing session hash

HI All ,

I am getting this error while caaling a apex method from onclick javascript  from a custom button .

Please suugest how to get session .
Khan AnasKhan Anas (Salesforce Developers) 
Hi Manojjena,

Greetings to you!

You can get the session id like this:
sforce.connection.sessionId = '{!$Api.Session_ID}';

Please refer to the below links which might help you further with the above issue.

https://developer.salesforce.com/forums/?id=906F000000095YSIAY

https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_connecting.htm

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas