You need to sign in to do that
Don't have an account?
Problem with SessionID Values
Hello everyone i have a strange problem.
i have created one visual force page which stores the current session id in my custom object's key field.
for retrieving the session id, i have created apex class which contains the webservice static method. which returns the session id of current session.
url of my current page is like this = https://c.cs4.visual.force.com/apex/Test
name of apex class is "mysession" and name of the webservice static method getSessionId and i am getting session id by usiing
String SessionID = mysession.getSessionId();
and i am getting SessionID = 00DP000000065Qa!AQEAQJoFPAmHIV4KrqzWQMhTeEcTVjFyxiv3S_YREhq6KU1yo5We5HM_tOZ4iUZlZfP04HmtPkohcNLG0AAzbDNAmzTbSCVg
i am storing this session =id in my custom object as key for the further retrieval of the record in my second page.
i am showing some data of that object in my Test page.
i have made one pageblock table. in which one colum contains hyperlinks. when i click on that hyperlink it directly redirects me to object record in new tab of my browser.
but then my url is getting changed from visual.force.com to salesforce.com. in that page i have added custom button "check" in my custom objects's page layout.
by clicking on that button i am retrieving the session id from my common apex class .
i have written the code of that button as onclick javascript event.
now url of page which is opened in new tab is like this:https://cs4.salesforce.com/a1DP0000001xhujMAA
this url refers to the record of my custom object's record.
now in that javascript i am using
var sessionID = sforce.apex.execute("mysession","getSessionId",{}); for getting a sessionid from common apex class
and i am getting sessionID like: 00DP000000065Qa!AQEAQBflbKcSP8DmYD0X2gpaBpiFlohTNL0jE9wcgoKnF44a05N.lUCJNryVF2eajb0sy9YRXHx2C07KzZrhrw0SciklDsct
now see both the session ids are different.
but why? that i dont know.
my quesion is "how can i have both the sessionids with same value ? ";
what can i do for this kind of problem?
i want both the sessionids with same value because i want to perform some action on the record of my custom object.
because i have stored that sessionid as key filed in my custom object.
any kind of help will be greatly appriciated.
Thanks in advance.
Learn And Contribute.
in page layout properties view option is there by changing it to VF page we can solve this...........
thanks for the help.
All Answers
Why do you need to store SessionId when you are working within Salesforce itself? Also, the SessionId value is different for each login and the old SessionId has no use once a new Session Id is generated.
in page layout properties view option is there by changing it to VF page we can solve this...........
thanks for the help.