Unable to update multiselect field
I have a form with a multiselect lookup field "Known_Players" that points to the field "Name" of the same form. When the name of a player is changed I want to update all the Player records in which the name is selected in the Known_Players field. For this I have the following code in the on success / on edit event:
for each player in frmPlayer [Known_Players.contains(input.Name_before_edit)]
{
oldList = player.Known_Players;
newList = List:String();
for each item in oldList
{
if (item == input.Name_before_edit)
{
newList.add(input.Name);
}
else
{
newList.add(item);
}
}
player.Known_Players = newList;
}
In order to offer the updated name as a choice in the field Known_Players I added the following line in the on user input event of the field Name:
Known_Players:ui.add(input.Name);
This works fine.
But: Udating the list (player.Known_Players = newList;) fails.
Any suggestions?