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

User Logged-in for the first time

TanmeyTWX
17-Peridot

User Logged-in for the first time

Hi,

Is there any built-in way to check if a user logged for the first time?

For example: Thingworx Form-Login page loaded and user logging-in first time--> Mashup with Message "First time login"-->Required Home page Mashup

Same user logging-in again--> Required Home page Mashup

Anyone worked on this same scenerio?

Thanks.

5 REPLIES 5

Hello Tarun,

From your description, maybe you are building the system to face the public users, so you want a welcome message for them, while the Users in system are more likely to be long-term internal users by design, so there wasn't a build-in "visiting counts" record for each account OOTB, you may need to write your own service and use an entity to keep the record.

When the user is logging in the composer (design time), we have "Restore Tabs" for last connection,

but for mashup users ( Formlogin page, run time), each visit is new.

What's more, FormLogin page comes with Organization settings, and change the bounding Home Mashup dynamically is hard, adding an extra mashup between the FormLogin page and Home Mashup based on visiting time might be harder, so it's not applicable in design.

My advise is that you could build a service to record the User login times or User session times in a DataTable, and bind the FormLogin page to Home Mashup directly. In MashupLoaded event, execute a service to check if this is a new user, and decide whether or not to popup a Window (Navigation widget) or message (Status Message widget)  with "First time login" as response.

There's no built-in, but can be easily developed. Ryan pointed out it.

But I think the best approach will be to Add a property on User's Settings named firstLogin with default value to true. Then you just need to check for that property at your "root" mashup Load event and act accordingly.

Best Regards,

Carles.

You mean change the User Extension datashape and add a Boolean data in right? Sure it's better than develop a datatable for that.

Yup.

Just to clarify the process:

Add a property on "UserExtensions" ThingShape called firstLogin with default value set to true.

Then on the mashup that's loaded once the user had login, you can call "GetCurrentUserExtensionProperties" from CurrentSessionInfo resources and here you will find firstLogin property on "All Data".

You can bind this firstLogin to a Validator Widget which if it validates to true then it can trigger a PopUp, a Navigation or whatever you want to do on First Login.

A the same you trigger the PopUp you should call back the server to set firstLogin property to false, to do this I think you will have to build a custom service on a helper thing to do this job. The code snippet to set UserExtensions property value will be something like this:

Users[Resources["CurrentSessionInfo"].GetCurrentUser()].firstLogin = false;

Top Tags