like action problem

like action problem

  

hey can you help me solve this problem please


Hi Musgado,

"The Insert statement conflicted with the foreign key constraint..." this error comes when you are trying to insert a NULL VALUE in a referenced attribute of an entity. Before you use Create or Update entity action, make an assignment to the referenced attribute by assigning a proper ID to that attribute, then you will not get this error.

 Hai MUSGADO,

 If you have direct asses to your database you can check which Entity attribute is giving Constraint issue. By checking in "ALL_CONS_COLUMNS" table of Oracle. or else you can do the same in service studio using 

Advance SQL widget.


Thanks

Ramakrushna Rao Seera


hi thanks for the reply ...can you please give me an example on how to do that using Advance SQL widget im kind of a slow leaner..please if you dont mind...thank you

musgado

Hi Musgado,

You can already see what causes the problem from the error message. First, there's an INSERT statement, which means a Create Action in OutSystems. There's a foreign key constraint violated, which means you try to Create (insert) a record of an Entity that has a mandatory Identifier of another Entity, and you didn't specify a valid one (probably an empty one).

Next, OSFRK_OSUSR_RRC_POSTLIKE_OSUSR_RRC_ACTIVITY_ACTIVITYID breaks down into the following parts:

OSFRK - this is an OutSystems FoReign Key (i.e. a reference to another Entity)

OSUSR_RRC_POSTLIKE - this is an OutSystems USeR table, RRC is a hash value for the specific eSpace it lives in (needed because you can have mutliple Entities with the same name in different eSpaces), POSTLIKE is the name in OutSystems (as can be seen in Service Studio), and is the Entity that has a reference to another Entity.

OSUSR_RRC_ACTIVITY - this is another user table called ACTIVITY in Service Studio, and its the Entity that is referenced by POSTLIKE.

ACTIVITYID - this is the name of the Attribute of the POSTLIKE Entity that has as Type the Id of the referenced Entity (so it's of type Activity Identifier).

Then the database is mentioned, but that's the least interesting part. It mentions the table (i.e. Entity) dbo.OSUSR_RRC_ACTIVITY, which we've seen above, and the column (i.e. Attribute) "ID". So the "ActivityId" of the Postlike Entity refers to the "Id" of "Activity", and you forgot to set it.

What this means functionally, is that an Activity can have one or more Postlikes, but a Postlike must belong to an Activity. And since you just tried to create a Postlike without specifying a valid Activity (via its Id), you get an error.

Hi..


If you don't have database access you can follow below.


If you have database access you can follow below process..


For more information you can visit..

https://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_1042.htm#REFRN20045 


thanks

Ramakrushna Rao Seera


Ramakrushna Rao Seera wrote:

Hi..


If you don't have database access you can follow below.


If you have database access you can follow below process..


For more information you can visit..

https://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_1042.htm#REFRN20045 


thanks

Ramakrushna Rao Seera



hi i dont really understand what you mean.can you please explain using words to me please