Hi,
Is there any possible way to use another entity for login and sign up other than the default User entity?
I want to add some additional parameters to the user entity, I tried creating an extension of the user entity but was not able to achieve the desired results. so if there is any way to create login functionality for other entities please do let me know.
Thank you!
Hi Mayuri,
Extension entity is the only way, recommended way and supported way.
Can you elaborate what issues were you facing when you tried to go with extension of user entity?
Okay, I'll try to implement it only then. So actually I am creating a referral system where a user1 can refer another user2 and the user1 who referred will get points also there is a static entity involved. So in this case I created a User extension entity with Points and count attributes and also a status id (static entity identifier) for checking if the user is verified, so here when I am registering a new user it is not creating the user extension with 0 id as shown in ss attached. Please do let me know if I am correct in understanding this error and how I can implement it.
That means, Your user identifier is not getting passed. Can you share the OML or snaps of your action flow, so that it would be easier to find the issue :)
Cannot share oml but here is the Register Screen Action and database relation, Please let me know if my database relation is correct or not, I doubt it.
Thanks for replying.
I don't understand that User Extension is a solution.
If you don't want the Users entity, and not want to use an external user provider. Than you can create another OutSystems user provider.
You can clone OutSystems Users, and make your own logic. In an app you then can set what us the user provider, which by default is set to Users.
Thanks for replying Daniël, can you provide any resource where I can refer to clone the Users and set the new entity as the default user? Because I am trying to build two applications one is for users which is a mobile app and another is for an Admin which is a traditional web app, in this case, the use of the default entity is really making things complex. Please suggest the required steps I can perform.
Creating two applications with different User provider (like Users module) won't be possible in your case. This is supposed to be done when you've two sets of userbase which don't interfere in any manner with each other. In more than 99% of the applications on Outsystems, you don't need to clone the Users module.
I'm sure your data is not modeled correctly, which is why you are thinking to clone Users module.
Imagine if Admin app and Users app using different User Provider modules, then there will be not admin app for your main mobile app's data, and there won't be a mobile app for the data being managed by your admin app, wondering what the admin is going to manage.
Hy Mayuri,
Here you find more information about User Provider.
https://success.outsystems.com/Documentation/11/Developing_an_Application/Secure_the_Application/End_Users/End_Users_Authentication/Single_Sign-On
I agree with Ravi, that you should really be mindful if this is necessary to create your own user provider.
Why do you want your users registered somewhere else than in Users Default User provider?
Hi Ravi,
I have to create two applications one for Users which is a mobile app and the other for Admin which is a Traditional web app for managing mobile users. So suppose user1 referred others to register on our app by providing the referral code to new user2. As soon as new user2 is logging in, we need to update the user1 points to 10 as he has 1 user referred under him. All users will be verified by the admin and only verified users can refer others. So in this case admin also has a feature to see the current users with their points. And as the points increase the users will have three milestones namely bronze, silver, and gold, so this should also be visible to the admin from high score to low. Also, there are some additional requirements.
Now here If I am using a user extension in the User app so it is not getting updated and showing a key violation error. and If I consider the User entity as Admin in the Admin web app that is also not possible as it already has an extension in the user app and the updation is not possible.
I am not understanding the database schema for this and if I use entirely different entities as user and admin then is it possible to solve this issue? and how can I achieve that?
Thank you for the link Daniël, and as both the admin and user are referring to the same default user entity I am not sure how I can define different login for them. as every user either in the mobile application or the admin web app is getting stored in Default User Entity.
If you have a mobile app, and a web app, each app has its own login screen already.
You can after login validate the role, and reject the role that is not allowed to login to the app. And even this you should not even need to do as you already set the correct roles on screens. So even after login, a screen could be accessed for which the role is not authorized and OutSystems will shown the Not Authorized screen.
That's should be very straight forward, and does absolutely not justify to have another user entity or user provider.
Yes, this is kinda straightforward for login functionality. Thank you. I'll try to implement it with default user provider.
Don't take one to one relation in UserExtension. It wont allow you to add record for same user. One user can refer multiple people right? So, it should be on to many and the UserExtension entity should be a junction entity. see below screenshot:
Also, In the CheckReferrelCode action, what filter and join have you used? And what is the condition inside if widget?
Also, can you show the UpdateUserEntension CRUD action?
Hi Shubham, actually I have used the referral code as the user id of the user, so I have checked whether the referral code entered is present as the user id in the table. And I have some warnings in applications as we cannot take user identifiers as Input so I made the referral code an integer that's why the below warnings are there and UpdateUserExtension is auto-generated entity action.
Hello Mayuri,
The error warnings are appearing because of the wrong filter. You are trying to compare the userid with referral code which is not correct.
Yes, as I told you in my reply, I was trying to consider the userId as a referral code but that is not possible. so yes got it and thanks for replying. The way you suggested adding a junction entity that also tried but there are different entities as well and it is not possible.
You need to add filter with user identifier. It would be like UserExtension.UserId = User.Id
Let me know if you need OML demo
Hi, is it possible to use UserId as a referral code? suppose user1 has userID 130 so it should be his code and when user2 login and enter the referral code we'll check during login if the userID is present in the database if it is then we'll update the points of the user with that userid in this case 130. Is it possible? if it is then please provide OML demo.
Yes. It is possible. you just need to compare the userId from both the enities.
Thank you, will try to implement this again.
Sure. Let me know if you face any difficulty