Taking reference of service side entity in application side entity in mobile app
Application Type

Hi All,

I just need some information regarding the entity model in the mobile App. Can we have an attribute on the Local entity as the foreign key of the entity present in the service side (for both static and normal entity types)?

Hi Pranav,

If I understand your question correctly, you should be able to define your Local entity so that one of its attributes is a foreign key to an Entity that may even be only present on the Server Side. 

Just take in mind that depending on your use case, the foreign key attribute might not be useful by itself, and you could instead bring a more meaningful field from the Server Side to be copied directly to your entity (handled in your Data Syncing process), as a way to enhance performance and avoid doing entity joins on the local storage:

However, note that this doesn't work the other way around as the Local storage identifiers are not unique across devices, therefore the server side doesn't have a way of meaningfully interpreting a foreign key based on Local Storage entity identifiers. The Syncing patterns that OutSystems recommends should help out in this sense by laying out a concrete step-by-step guideline that allows you to handle complex scenarios, such as the Read/Write Data One-to-Many pattern.

Let me know if that helps or if maybe you can share more details about your specific problem or need so we can help you in a better way.

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