Skip to main content
1-Visitor
April 22, 2021
Solved

How to trigger a custom event every time a user accesses ThingWorx

  • April 22, 2021
  • 3 replies
  • 3297 views

Hi Team,

 

Hope everyone is doing well.

 

I would like to know how will I throw my custom event each time a user logs in and logs off ThingWorx.

 

Thanks in Advance.

Best answer by SrijithKrish

Hi @slangley 

 

Thank you for the response. The current implementation uses a scheduler that monitors the number of users logged in and compares with the users before in a particular interval. This implementation is working currently.

 

Thank You @BABA-SHYAM those events are very useful I had tried them but the problem was during logging out, there will be users who might not log off in the required manner.

3 replies

Community Manager
April 22, 2021

Hi @SrijithKrish.

 

Are you referring to a user logging in to Composer or a mashup?  If you're referring to a mashup, you could design a service to run each time the user logs in.  Logging out would be more difficult since it requires a user to logout elegantly instead of just closing the browser.

 

Regards.

 

--Sharon

Community Manager
April 29, 2021

Hi @SrijithKrish.

 

Another way to capture successful/unsuccessful logins is to turn up the logging level (we think it's debug).  This will capture information in the security log, but with the logging level set this high, you will have an increase in the number of logs requiring more disk space and overhead.  It will also make it more difficult to research issues due to the size of the logs.

 

The "LoginSucceeded" event is also something that can be used as stated by @BABA-SHYAM but doesn't address logout.  Is that enough for your use case?

 

Regards.

 

--Sharon

15-Moonstone
April 29, 2021

Hello,

 

Security monitor do address all these scenarios. See below image.

BABA-SHYAM_0-1619709048951.png

Regards

Shyam

15-Moonstone
April 29, 2021

Hi,

 

There is a security monitor thing (don't select template with same name) available in thingworx. There you will find a "LoginSucceeded" event under it. This event will work if your user is login by typing the credentials. There is another event available "ApplicationKeySucceeded " if user try to access thingworx using app key. Every time this event occur you can run a custom event.

 

Regards

Shyam

Community Manager
May 10, 2021

Hi @SrijithKrish.

 

Have you found a solution to your issue?  If so, we would be happy for you to post it here for the benefit of others in the community.

 

Regards.

 

--Sharon

SrijithKrish1-VisitorAuthorAnswer
1-Visitor
June 1, 2021

Hi @slangley 

 

Thank you for the response. The current implementation uses a scheduler that monitors the number of users logged in and compares with the users before in a particular interval. This implementation is working currently.

 

Thank You @BABA-SHYAM those events are very useful I had tried them but the problem was during logging out, there will be users who might not log off in the required manner.

15-Moonstone
June 2, 2021

Hi,

 

What is the role of those users? I don't think any such issue could happen while logging out the user. User logs out successfully right? Its only the trigger which doesn't run. Is it happen always? Did you try to debug the issue?

 

Regards

Shyam