cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Get the current session id from the opened mashup

nikkolasep
10-Marble

Get the current session id from the opened mashup

Hi all,

 

I'm currently trying to trace down the usage from some mashups. The idea is to create a service that will be triggered by auto refresh every 60 secs containing (user, datetime, mashupname, current session id). Does anyone know how to obtain the current session id from the opened mashup (see the link below). Is there any session parameter that contains this?

 

e.g. https://thingworx-server/Thingworx/Runtime/index.html?mashup=Templatename&forceClose=true&__enableBMF=true&__fromNextGen=8587fe65-9d60-4cb0-bbcb-7d41a78d2169&features=#master=Mastertemplate&mashup=&forceClose=true&features=

 

1 ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To:nikkolasep)

Hello,

 

You could use the "TW.location.href" function that is available in the Thingworx runtime (expression or validator).

This function gives you the entire URL, so you would have to write some code to get just the token.

 

The following gives some information around the runtime functions in Thingworx: PTC Help Center

 

Hope it helps.

 

Regards,

Jens

View solution in original post

5 REPLIES 5
jensc
17-Peridot
(To:nikkolasep)

Hello,

 

You could use the "TW.location.href" function that is available in the Thingworx runtime (expression or validator).

This function gives you the entire URL, so you would have to write some code to get just the token.

 

The following gives some information around the runtime functions in Thingworx: PTC Help Center

 

Hope it helps.

 

Regards,

Jens

I tried to call the function via expression function but I don't get any value. What I did is I created a expression function and write the following:

output = TW.location.href; //Output as a String

I then bind it with a label

Do you know what is the cause of this error or is there another way to get the complete url? 

jensc
17-Peridot
(To:nikkolasep)

Hello,

 

Did you trigger the service in any way?

As an example, you can use the mashups "Loaded" event to trigger the service.

The "Auto Evaluate" doesn't work unless you have an input that changes.

 

Regards,

Jens

Yes I'm already aware of it. I just found that the issue is with the extension that interrupts this process or value of TW

Otherwise, if I tried to a plain thingworx server or sandbox, it works perfectly as you said and we expected. Thanks for the solution! 

Top Tags