Hi Outsystem team.I am currently taking the exercise "Demo: How To Create and Use Actions" for "O11".In "Demo How To Create and Use Actions.v11.ja-JP.3711811d.mov" (After 3:32) said."As expected, the logic went through successfully and we're back at the Orders Screen." But I have a problem this error The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_2LU_ORDER_OSUSR_2LU_EMPLOYEE_CREATEDBY".How can I solve this problem?
The environment I am using is "personal-xxxxxxxx.outsystemscloud.com".
For example, will it be successful if I log in with a different account rather than my personal account?
If a different account has been prepared for this exercise, please let me know the account and password I can use to log in.
Hi Mihai Melencu, Mihai Melencu
Thank you for your advice.
The problem with the exercise "How To Create and Use Actions" has been solved.
The steps I performed are as follows:
1).Select “Modules” in the top left of Service Studio.
2).Select “Module Management in Service Center” from the “Modules” pull-down menu.
3).Log in to the service center in my personal environment.
4).Select My Account in the top right corner of the Service Center.
5).Select "Life Time" from the top of the screen.
6).Identify "UserId=" from the URL of the screen.
7).Return to the service studio.
8).Select the "Data" tab.
9).Double-click the "Employee" table.
10).Click the “No Filters” tab.
11).Click the “Add filter” button.
12).Enter "Employee.Id = " in "Filter Condition" and click the "Close" button. (At this time, confirm that there is no data for in the existing data.)
13).Click the "Add Row" button.
14).A: "Id" is the UserId found in the "Life Time" URL, B: "Pictre" is where I upload an appropriate image file, C: "Filename" is where I enter an appropriate file name, then press the "Apply" button.
15).The message "The database has been successfully updated." will be displayed at the top of the screen, indicating registration was successful.
16).Press the “Publish” button.
17).Click the "Add Order" button in the top right of the "Order List" screen ("Orders" screen).
18).On the displayed "OrderDetail" screen, enter "New Order (After Employee Added)" in the "Description" field according to the instruction manual, and then click the "Save" button.
19).Return to the "Order List" screen ("Orders" screen).
20).From the list screen, select the link for “New Order (After Employee Added)” that I just registered.
21).On the "Order Detail" screen, I confirm that the order details I registered earlier are reflected.
That's all.
In my previous post, I left out "Delete Filter" between 12 and 13.
Hi @Hirokazu Ikeda ,
This is likely not working because the CreatedBy attribute is of type EmployeeId, but you're assigning it the result of GetUserId(). Most likely, there's no corresponding record in the Employee entity with that UserId.
Make sure the Employee entity contains a record linked to that UserId.
Hi @Redtop,
The error you're seeing happens because the current user (from GetUserId()) doesn't exist in the Employee entity. The system is trying to link the order to an employee, but can't find a matching record.
In the Employee Entity add a new record with the User ID of the account you're logged in with.
Then try saving the order again — it should work.
You don’t need a different account. Just make sure your current user exists in the Employee table.
Hope this helps!
Thanks,
Supriya