On clicking logout button, it needs to be land on organisation page.
If i need to provide organisation page url for redirectURL of logout button means, syntax will be
<server name>/Thingworx/FormLogin/<Organization Name>.
The server name differs system to system. I want to provide this dynamically.
1. So when the user logging in the organisation page, any possibility is there to store the url in session variable? So that i can reuse the url for logout widget redirectURL.
2. (or) any other way is there to get server name of any server dynamically using service??
Solved! Go to Solution.
Yes. The javascript code to capture server name is not running inside services. So i created an expression with the code: Output=location.host; It is returning server name of current server. Along with this i attached the url format and passed current Organization Name from service of CurrentSessionInfo. Now this code is returning the organization page url successfully. Output="http://"+location.host+"/Thingworx/FormLogin/"+OrgName;
I've at times been able to do this successfully with setups like ./Thingworx/FormLogin/OrgName or ../ worth a try.
@PaiChung Can you please eloborate?
In the above mentioned setup how you will pass the hostname and port number? from where you will get it ?? ( It should not be hardcoded!!! )
How this will help in passing a complete organization url dynamically?
I tried these codes to capture login page url using service, but it doesnt worked.
window.location.href;
window.location.origin;
var result= window.innerWidth;
var url = window.location.host;
var url = window.location.hostname;
var port = window.location.port;
The error is "Error executing service Trial. Message :: ReferenceError: "window" is not defined. - See Script Error Log for more details."
I probably misunderstood what you were looking to do.
the ./ or ../ will utilize the Tomcat folder structure the pages are in.
Not sure, but perhaps you'll have to maintain a piece of information associated with the user and generate that into a link with a service.
Yes. The javascript code to capture server name is not running inside services. So i created an expression with the code: Output=location.host; It is returning server name of current server. Along with this i attached the url format and passed current Organization Name from service of CurrentSessionInfo. Now this code is returning the organization page url successfully. Output="http://"+location.host+"/Thingworx/FormLogin/"+OrgName;
Potentially you can use CurrentUserSession functions as well.
Can you please name any service in currentsessioninfo which returns hostname/servername like that?
GetCurrentIPAddress
GetCurrentUserOrganizations
But I think it's not the user IP you are looking for ...
Yes, we need IP address and current organisation. Any service available in thingworx to get port number also?
Don't know about port, not sure if the 'location' object client side would provide that or not.
Okay
Thanks