Skip to main content
Dynamics 365 general forum

How to get session ID through JavaScript?

editSubscribe (0) ShareShare
Posted on by 162


This might be a stupid question, but I cannot find answers from MS documents.

From JavaScript, how can I get the session ID as shown above?

Thanks a million,


  • Verified answer
    Ning Zhu Profile Picture
    Ning Zhu 162 on at
    RE: How to get session ID through JavaScript?

    It is in sessionStorage, pretty easy to read

           var storage =;

           var sessionId = storage.getItem("UNEXPECTED_TERMINATION");

    Hope, that can be useful to someone who are facing the same issue, sometime, sessionId will take 1 second to load, so add a timeout statement over will be a great idea

  • Guido Preite Profile Picture
    Guido Preite 53,906 Super User on at
    RE: How to get session ID through JavaScript?

    I don't think there is a way (also unsupported) to get that value.

    Do you have a specific reason to have it? Technically should be the same as putting a GUID inside the sessionStorage (and I am not suggesting to do)

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…


Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,045 Super User

Martin Dráb Profile Picture

Martin Dráb 222,570 Super User

nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans