36
Views
3
Comments
Solved
Extending the User entity - Dropdown error
Question

Hello, first time poster. I'm using Service Studio 11.7.3

I’ve come across an issue that I think might be a bug, or perhaps I’m not fully understanding what is going on behind the scene?

To reproduce the issue:

Create a Reactive Web App with a standard module.

As per the instructions at https://success.outsystems.com/Documentation/How-to_Guides/Logic/How_to_add_extra_logic_to_Users'_login

I’m going to create a UserExtended entity with some additional data:

Entity : UserExtended
Id :  Data Type “User Identifier”
BioData : Data Type “Text”

I now want to create a screen that will allow me to add records to the UserExtended table for existing users, and populate the BioData attribute.

If I drag the UserExtended entity onto my UI Flow screen, it will automatically create a UserExtendeds screen, which lists all the records, and a UserExtendedDetail screen, which allows me to edit or create records.

The UserExtendedDetail screen that is generated will only display the BioData attribute, which is fine for editing existing records, but no good if I want to add a new record, as I will need to select which User Id I am adding data to.

Create a GetUsers aggregate that queries the Users entity and returns all records.

Add a Dropdown box to the form on the UserExtendedDetail screen:

Variable – GetUserExtendedById.List.Current.UserExtended.Id
List - GetUsers.List
Options Content - Text Only
Options Test – User.Name
Options Value – User.id

This won’t work. It complains about the variable setting and flags an error:

Invalid Data Type   ‘User Identifier’ data type expected instead of ‘UserExtended Identifier’

My question is “why?”

I haven’t used a data type of ‘UserExtended Identifier’ anywhere, even the Id field for the entity is set to a different identifier type (User Identifier) so I’m not sure why it is throwing this error?

mvp_badge
MVP
Rank: #2
Solution

Hi Darren,

Service Studio is pretty finicky about data types sometimes, and this is one of the cases where I think it should be a bit more lenient (as it is in Traditional Web). Your Variable is the UserExtended.Id, and though the data type of UserExtended.Id is User Identifier, the Id itself is deemed to be a UserExtended Identifier since it identifies the UserExtended Entity.

The best solution here is to create a Local Variable of type User Identifier, and use that as the Variable. When you're going to save the record, you can assign it to GetUserExtendedById.List.Current.UserExtended.Id.

mvp_badge
MVP
Rank: #2

Hi Darren,

Service Studio is smart enough, as it works fine with Traditional Web. I think it's a bug, and reported it to OutSystems. They told me it was already on their list of things to fix, so I hope they can fix it soon.