Cannot create registered users on my outsystems

Hi. so basically I'm trying to create a sign up page where the users can log in after they sign up

however the data they are inputting I'm trying to save to two different tables, one is the system User and the other is an extension of the system User. The inputted data is being put into the User data  but i still can't log in with those credentials. Any help would be greatly appreciated. Here is a screenshot of the code behind the button to save


The error coming up now is this The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_16A_USEREXTENSION_OSSYS_USER_ID". The conflict occurred in database "TVYWGK003", table "dbo.ossys_User", column 'ID'. The statement has been terminated. 


Solution

Hello Mary,

I have created People entity and attribute UserId as Foreign key to map with User table.

Here is Interface Flow from Login client action we navigate to Signup Screen and created one more Screen to show Users Listed.

On Signup Screen in RegisterOnClick client action we need to create functionality that save user data and people data in respective database table.

  1. First as you know drag and drop EncryptPassword Run Server Action enter username and password from local variable "User" created on Signup UIScreen.
  2. Second drag and drop Assign and encrypt that password.
  3. Third drag and drop CreateUser Run Server Action and give local variable "User" as Source.
  4. Fourth drag and drop  Assign and assign User.Id=CreateUser.Id.
  5. Fifth drag and drop  Assign here now we have to assign People.UserId=CreateUser.Id before calling CreatePeople Run Server Action.
  6. Sixth drag and drop CreatePeople Run Server Action and give local variable "People" as Source.


Signup UIScreen register button carry main logic discussed above.

User Database
Details are getting saved in user table from Signup form.

People Database
Details are getting saved in People table from Signup form.

Login UIScreen
We can login Successfully from Login UIScreen.

UserPeople UIScreen
Details of Registered User and People Detail are shown.


Regards,
Ayush khare

That worked! Thank you so much for your help!

Hi Mary,

You mention that you write to Users and  UserExtension, your screenshot only shows you create or update Users entity. Did you set the Id of UserExtension to UserId?  From the information you share that is not to be concluded. Sharing your entity model with the definition of the relationship between the two entities might give more insights.

It looks like you try to create a UserExtension record without a valid UserId. 

Regards,

Daniel

Hi Daniel,

I don't think I can set the Id of UserExtension to UserId because it's coming from an external database. Would i be able to do that in the sql server studio do you think?

Kind regards,

Ailish

Solution

Hello Mary,

I have created People entity and attribute UserId as Foreign key to map with User table.

Here is Interface Flow from Login client action we navigate to Signup Screen and created one more Screen to show Users Listed.

On Signup Screen in RegisterOnClick client action we need to create functionality that save user data and people data in respective database table.

  1. First as you know drag and drop EncryptPassword Run Server Action enter username and password from local variable "User" created on Signup UIScreen.
  2. Second drag and drop Assign and encrypt that password.
  3. Third drag and drop CreateUser Run Server Action and give local variable "User" as Source.
  4. Fourth drag and drop  Assign and assign User.Id=CreateUser.Id.
  5. Fifth drag and drop  Assign here now we have to assign People.UserId=CreateUser.Id before calling CreatePeople Run Server Action.
  6. Sixth drag and drop CreatePeople Run Server Action and give local variable "People" as Source.


Signup UIScreen register button carry main logic discussed above.

User Database
Details are getting saved in user table from Signup form.

People Database
Details are getting saved in People table from Signup form.

Login UIScreen
We can login Successfully from Login UIScreen.

UserPeople UIScreen
Details of Registered User and People Detail are shown.


Regards,
Ayush khare

That worked! Thank you so much for your help!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.