120
Views
5
Comments
Solved
Dropdown inside table cell to assign to users
Question
Application Type
Reactive
Service Studio Version
11.54.11 (Build 62474)

Hi there,

I'm working on some concept for an issue dashboard where a user can see a table of rows with ticket details, and select from a dropdown menu inside a cell who this issue should be assigned to. The table is an aggregate based on several joins; the 'assign' column was inserted on the screen after the database was made.

For this, I've added a dropdown that retrieves a distinct list of usernames and assigns it to a variable. Initially, selecting something client-side would change all of the dropdowns as they share a variable. So one solution I saw was to put the dropdown inside of a block to limit the scope of the variable, which I've done:

However, this only changes the user on the client-side, and I want it to be persistent for all users. So that changing it and refreshing it page afterwards would keep the selected name.  I've tried creating an action where it would perform an update on the data, but the database is outside of the scope of this block I think. I'm also not entirely sure if updating that works as the column was inserted afterwards. At this point I'm a bit lost on how I can make this work...

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi AnotherTech,

1) if you want to persist the choice, for starters you need a place in your datamodel to store the assigned user.  So that would probably be something like a reference attribute in your Issue list to user : so not a name, but an identifier !

2) You do not really need to use a block just to be able to put a dropdown in your list, you just need to have a spot in your table's aggregate to store the chosen userid, and that should be the variable that your dropdown is connected with.

3) for example, have an attribute called Assignee in your Issue entity, that is of type UserIdentifier, this will be part of the resultset of your aggregate for the table, the dropdown's "variable" property, should be GetIssues.List.Current.Issue.AssigneeId

4) A simple approach is to have an OnChange on the dropdown, have an input parameter into the OnChange to pass in a whole issue record, and just do an update of that record, in the screen, you will pass in GetIssues.List.Current.Issue to that input of the OnChange action.

5) If you are very concerned about performance, just pass in the Issue.Id, and the Issue.AssigneeId into the OnChangeAction, and have some server action, either fetching the whole record by Id, assigning the new assignee in it, and doing the update

Dorine

2021-09-06 15-09-53
Dorine Boudry
 
MVP

see attached oml doing the simplest version (4)

QDR_AssignFromTableRow.oml
UserImage.jpg
AnotherTech

Thank you kindly for the comment and example, I'll try it out

UserImage.jpg
AnotherTech

To update, I indeed haven't handled the assignment column in the best manner, and have adopted a design much in line with above's solution. Thanks again!

2023-05-08 05-34-05
Piyali Saha

Hello,

As per my understanding of the scenario, you must pass that changed value to parent and call the update function of the database to update the drop-down value into the database so that it does not get refreshed after screen reloading.

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi AnotherTech,

1) if you want to persist the choice, for starters you need a place in your datamodel to store the assigned user.  So that would probably be something like a reference attribute in your Issue list to user : so not a name, but an identifier !

2) You do not really need to use a block just to be able to put a dropdown in your list, you just need to have a spot in your table's aggregate to store the chosen userid, and that should be the variable that your dropdown is connected with.

3) for example, have an attribute called Assignee in your Issue entity, that is of type UserIdentifier, this will be part of the resultset of your aggregate for the table, the dropdown's "variable" property, should be GetIssues.List.Current.Issue.AssigneeId

4) A simple approach is to have an OnChange on the dropdown, have an input parameter into the OnChange to pass in a whole issue record, and just do an update of that record, in the screen, you will pass in GetIssues.List.Current.Issue to that input of the OnChange action.

5) If you are very concerned about performance, just pass in the Issue.Id, and the Issue.AssigneeId into the OnChangeAction, and have some server action, either fetching the whole record by Id, assigning the new assignee in it, and doing the update

Dorine

2021-09-06 15-09-53
Dorine Boudry
 
MVP

see attached oml doing the simplest version (4)

QDR_AssignFromTableRow.oml
UserImage.jpg
AnotherTech

Thank you kindly for the comment and example, I'll try it out

UserImage.jpg
AnotherTech

To update, I indeed haven't handled the assignment column in the best manner, and have adopted a design much in line with above's solution. Thanks again!

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