Assign UserId to UserExtensionId when creating new User

Good day,


I have a fairly simple question, I just forgot the implementation method. I have created a UserExtension entity with UserId as its primary key. I have an action that creates a new User, in that same action I want to create the UserExtensionId using the new UserId. I have attached the action flow.


Your help is kindly appreciated.


Regards,

Malebo


The CreateUser server action will return an auto generated Id as output parameter. You can use that ID to insert into UserProfile.


Hi Babu,


How would I implement that in the action flow? 

In the action flow, should I assign the Id output to a user profile variable then add a create user profile action in the action flow to assign the user variable as the create user profile source?


I have implemented the above to test the outcome but I get a error.

Hi,

Check the data in Primary Table May be you are entering a column value which is not present in the primary key column. 


Vijay M-



Hello Malebo Sambo ,

Please make sure you set all the mandatory attributes of UserProfile with valid values and call CreateUserProfile. It should work. From the error looks like Gender is expecting a value in UserProfile entity. 

Also One more thing, Usually for tables like UserProfile/UserExtension, we set the Id of the column to User Id foreign key just to maintain relationships and data integrity.

Thanks,

babu

Babu Basha wrote:

Hello Malebo Sambo ,

Please make sure you set all the mandatory attributes of UserProfile with valid values and call CreateUserProfile. It should work. From the error looks like Gender is expecting a value in UserProfile entity. 

Also One more thing, Usually for tables like UserProfile/UserExtension, we set the Id of the column to User Id foreign key just to maintain relationships and data integrity.

Thanks,

babu

 

 true

Hello everyone,


I'm honestly not winning with this action even after implementation of your suggestions. Is there a new version of the platform?

Hello Malebo, 

Could you please share the UserProfile entity of yours. The only thing you need to make sure is to set all the mandatory attributes with a valid value in your assign where you set UserProfile.Id or make it not mandatory. Also update the Id of User profile table to have the UserId. See screenshots below. 

If you have a GenderId coulumn, Please make sure the IsMandatory property set to no.  



Hi Malebo,

Can you share the Module (OML, file) here?

Solution

Hi everyone,


I found the problem. The joins in the aggregate were not matching to populate the correct record in GetUserById which is in the userprofile screen. In this screen, I have an action that creates the userprofile Id (extension entity), which was the initial problem.


Thank you for your suggestions and effort, much appreciated.


Regards,

Malebo

Solution