Sorting a multiselect lookup on success

Sorting a multiselect lookup on success

Hi,

Here is a list of options selected in my lookup field called contact type (NB: It is a multiselect) that references my form contact types:

Warehouse
Accounts
Sales
Purchases

I want it to sort to alphabetical order:

Accounts
Purchases
Sales
Warehouse

The code I have written on the On Add-> On Success portion is as follows:


IDList = List();
for each ContactType in input.Contact_Type
{
    GetDetails  =  Contact_Types  [ID == ContactType];
    IDList.add(GetDetails.ID);
}
GetSortOrder = (Contact_Types[ID in IDList].ID sort by Contact_Type).getall();
input.Contact_Type = GetSortOrder;

For some reason, no matter what I try, this does not work.

Any ideas?

Regards,

Shaheed