22
Views
17
Comments
Primary Key in other entity issues with saving correct PK
Question
Application Type
Mobile

Hello people,

i have a entity called "Gegevens", in this entity i have a primary key of another entity called "Signature". But when i save it to the database the SignatureId always stays 0, however in the Signature entity the SignatureId is working correct and is auto incrementing. In the Gegevens entity is does not have the same Id as in the Signature Id.

GEGEVEN ENTITY (do not pay attention to the SignatureId's with 1, i tried things out that is why it is 1):


SIGNATURE ENTITY:


you see for example the SignatureId 6, but in Gegevens it is still 0. 

Rank: #94

Hello Samed,

Hope you're doing well.

Can you please verify that you're passing the correct value for SignatureId parameter when you're creating a record in Gegeven entity? It seems that you're creating those records without specifying the value for SignatureId. Therefore, it is created with the value 0, which corresponds to NullIdentifier.

I suggest that you debug your Create action to see what's happening.

Otherwise maybe you can share your OML file with us so we can take a look.


Kind regards,

Rui Barradas

Rank: #171

Hi Samed Gurses,

Can you share your .OML for we understand what happens?

your problem may be at the moment of populating the FK in the object, a configuration in the table field, among others.

Regards.

Hi Samed,

Can you please share your oml with us.

Thanks,

Samiksha

Rank: #470

Hi Samed Gurses,

I think you misunderstanding the behavior of the foreign key.

The SignatureId can't auto-increment, You need to set SignatureId to the correct value.

Best Regard

Rank: #171

Hi Samed, try update your code like this example:

use an assing to set Gegeves.SignatureId = CreateOrUpdateSignature.Id

after CreateOrUpdateSignature.

Regards.

Rank: #68

Hi Samed,


After the CreateOrUpdateSignature action and before the CreateOrUpdateGegevens action, you add an Assign with Gegevens.SignatureId = CreateOrUpdateSignature.Id.


That will do the trick.


Regards,
João

Hi Samed,

If your Input parameter holding id of signature, then you getSignature and pass it to Gegevens.Signature=getSignature.record.signature.Id.

Hope it's work.

Thanks,

Samiksha

Hi Samed,

The only issue i can see in the oml which you have shared is the "GetSignatures" aggregate.


their is no filter based on "SignatureId" in this aggregate and you are passing the current record of this aggregate to your server action which might be the reason of not updating the proper values in database.


Try by passing the record of that particular "SignatureId" to your server action.


Hope this helps you !!


Regard's,

LK