Hi,
An association is not set automatically. Is an optional member of the owning entity (dotted side of the association - in this case the Job)
If the association to the current user must be set at the moment the job is created (or saved) then this can be handled in a microflow. This microflow will retrieve the current UserProfile and associate it from the Job.
such microflow would look like this: https://modelshare.mendix.com/models/8626c714-fff3-4a21-a42e-71f81df95f09/after-create-set-job-user-profile
Mendix uses the object ID's automatically and therefore it is not needed to create your own ID's Such as Job_ID and ProfID.
Also using _UnderScores in your Attribute and Entity names will cause unreadable XPaths, so advise is not to use them.
In that case, your domain model would look like this;
Best, Rene
Hi,
Rene gives a great and detailed answer. I would just like to add that in this particular case where you want to store a reference to the account that created an object "Job" in your case, you can use the store owner functionality
You can then use the owner in microflows and on pages:
Have a nice evening,
Andrej
Abishek,
I think the problem you are running into, is that you are using the Mendix standard save button on that form. The standard save button will just commit the object "Job" in this case, but what you want to accomplish is to commit "job" and set an association to a user or the current user. Similar to what Rene said, you need to set the association user profile to Job. To accomplish this, you should use an action button instead of a save button on the form. The action button will call a microflow that passes the job object as a parameter. You will need to retrieve the current user account and then set the association to the user account and then commit the object.
Here is an example microflow - https://modelshare.mendix.com/models/fbe3caf5-692e-4a1b-80cf-e04e44f555be/example-microflow-for-forum-question-88290
Here is a link that explains how to import a microflow from model share. https://docs.mendix.com/refguide6/model-share
Additionally, regarding your domain model, you may be able to accomplish the same thing without making an entity called "User_Profile" but rather use a cross module association to the admistration.Account table.
As addition: two important links with valuable input for your challenge:
Online Learning module about the Domain model: https://gettingstarted.mendixcloud.com/link/module/4/lecture/172
Forum topic regarding the use of the User entity: https://forum.mendix.com/link/questions/88247