Dear Dynamics community,
I'm looking around on the FormComboBoxControl trying to find a property where I can pass along a key/value pair (thinking Dictionary in C#) to be able to have a locationId relate to a locationName. The user would choose the displayed locationName but it's the locationId I'm interested in passing on to the next step in the process.
Tried the item() property but that's merely an int, not an ordered list tied to the list. Same with containerId...
Any thoughts or ideas? Thought perhaps the .insert() would work but the second parameter is merely an index.
public void createOriginOptions(FormComboBoxControl combo, RecId party)
{
var sortedList = new System.Collections.SortedList();
combo.clear();
combo.add(NO_FILTER);
var mode = _manager.getMode();
var locationRole = LogisticsLocationRole::findByName(mode);
DirPartyLocationPrimaryAndRolesView locationRoleView;
LogisticsLocation location;
LogisticsPostalAddress originAddress;
while select LocationId, Description from location
join locationRoleView
where location.RecId == locationRoleView.Location
join originAddress
where location.RecId == originAddress.Location
&& locationRoleView.Party == party
&& locationRoleView.LocationRole == locationRole.RecId
{
if (sortedList.ContainsValue(location.LocationId)) continue;
sortedList.add(location.LocationId, location.Description);
}
for (int i = 0; i < sortedList.Count; i )
{
combo.item(i 1);
//combo.item(sortedList.GetKey(i));
combo.add(sortedList.GetByIndex(i));
}
}
[Control("ComboBox")]
class ShipFromOriginLocation
{
///
///
///
///
public boolean modified()
{
boolean ret = super();
int locationId = this.item();
str originLocation = this.valueStr();
if (originLocation != "")
{
_originTextSelected = originLocation;
_locationIdSelected = locationId;
}
return ret;
}
}