the conflict occured in database""the statement has been terminated

hi can you help me solve this error

Hi Musa,

the constrain is saying that the user doesn't exists in the user table, or you are setting a wrong user in the table media, try use GetUserId() function, or can you give us more detail about the issue.


Hello MUSA,

This error is probably the cause of your other post error.

You are trying to save a record in an entity, that requires a valid UserId, because it has a mandatory User Identifier attribute, but you're not providing one, or the the record where you are saving this info is not the same you are using as source to the Create entity action.

I would say this is the same record you are trying to fetch in the other post...


hi guys thanks for both your reply i appreciate both are right .so how do i fix that?do i create a valid UserId for it specifically ? How do i Fix it though and yeah @Eduardo you are right its the same record im trying to fetch from the other post

thanks for reply ...will be waiting for the next one


In order to solve your problem you need to assign a User Identifier to the Media Entity's mandatory attribute UserId before you insert/create the new record.

Which User Identifier you need depends on what you are trying to do, without further info, two possibilities might make sense:

  • you don't always need a User Identifier for your media, in which case you just change the UserId attribute to not be mandatory.
  • you do always need the User Identifier for your media, and in this case typically you'd want the current logged in user's identifier (that you can get with the GetUserId() function). in order for this to work, you need to be logged in though, or you'll still have the issue, as GetUserId() will return NullIdentifier().

thanks jorge i understand now

i tried but let me tell you ...i am trying to be able to post audio instead of text like in a normal todo but save audio but i cant play or post it its giving me this error but different from todo i want it to show userId of who posted the Audio thats all.

In that case, my second suggestion is the one you need:

  • Make sure the screen does not have the Anonymous checkbox ticked, as you want a user to be logged in.
  • On the screen action that handles your submit, assign to the UserId attribute of the Media entity the value of GetUserId() before you add the record to the database (using the Create* or CreateOrUpdate* Entity Actions)

thanks a lot man that really helped..sorry for late reply im sick