57
Views
8
Comments
Solved
Unable to create a User
Application Type
Reactive

I am creating an application that is used to simulate the basic banking actions such as deposit, withdraw and viewing transaction history. I am getting an error in my entity when i try to create a new user using the sign up screen which i have created. When i click on the submit button after entering the details this error pops up

"The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_ZL4_CUSTOMER1_OSSYS_USER_ID". The conflict occurred in database "BXFBNW011", table "dbo.ossys_User", column 'ID'. The statement has been terminated." I am using the default User entity available in the system. 

Customer's Id field is mapped to User's id and Transaction's Id is also mapped to User's id.


Can anyone please help.


Screenshot (7).png
2020-09-01 10-42-42
Stefano Valente
Solution

First thing i notice is that you create the account before the user. So you don't use the created userid in your account record.


since the UserId is the primary key in all your entities, create the user first. The CreateUser has the created id as output. Put that as Id in your other record creations.


Furthermore:

You have multiple server actions in 1 client action. I would recommend to put all you logic in 1 server action.


Finally:

It's your datamodel but it does strike as odd that your transactions entity has a 1 on 1 relation with the user entity. You can never do more than 1 transaction?

You can also only have 1 account per user (which is less strange).

Are you sure you want 1 on 1 relations, or do you need 1 to many?

2020-09-01 10-42-42
Stefano Valente

When you create a user, is your id empty? (nullidentifier())

 Could you show the server action where you create the user?

UserImage.jpg
Akash Venugopal

2026-02-26 06-29-24
Rahul
 
MVP

Hi Akash ,

you need to first create User and after that you need to create Account number details with created used ID Because you have took One to One Relationship between User and AccountNumberDetail Entity.


Hope this will help you.

Regards

Rahul

2025-04-17 05-42-16
Ajit Kurane

Hello Akash,

If possible could you please share sample OML.

We will able to resolve it easily.

Regards,

Ajit Kurane.

UserImage.jpg
Akash Venugopal

Could you please have a look at it

BankingApp.oml
2025-04-17 05-42-16
Ajit Kurane

I have updated your oml to create user. Rest thing you need to change from your side as already told by Rahul and Stefano.

Thanks,

Ajit Kurane.

BankingApp.oml
2020-09-01 10-42-42
Stefano Valente
Solution

First thing i notice is that you create the account before the user. So you don't use the created userid in your account record.


since the UserId is the primary key in all your entities, create the user first. The CreateUser has the created id as output. Put that as Id in your other record creations.


Furthermore:

You have multiple server actions in 1 client action. I would recommend to put all you logic in 1 server action.


Finally:

It's your datamodel but it does strike as odd that your transactions entity has a 1 on 1 relation with the user entity. You can never do more than 1 transaction?

You can also only have 1 account per user (which is less strange).

Are you sure you want 1 on 1 relations, or do you need 1 to many?

2021-12-23 13-59-24
Ayush Khare

Hello Akash,

I tried to implement your question with one to many relationship not with one to one relationship

Entity Diagram
Form UI

Assign
Before User

Before Customer

Before IdProof

Data Saved / User Created
Customer data Saved Customer Created

User data Saved User Created


Thankyou
Ayush Khare

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