Dynamically adding sorted record IDs to a multi-select Lookup field

Dynamically adding sorted record IDs to a multi-select Lookup field

EDIT/Solution: instead "equals to" or ui:add, use .select (https://www.zoho.com/deluge/help/client-functions/select-deselect.html).
  1. IDs = Form1[Criteria].Lookup.getAll().distinct();
  2. IDsSorted = Form2[ID in IDs] sort by SortField;
  3. input.MultiSelectLookup.select(IDsSorted);

Original Problem:

I can dynamically add IDs (on User Input of another field) to a multi-select Lookup field, but I can NOT add sorted IDs.
  1. IDs = Form1[Criteria].Lookup.getAll().distinct();
  2. IDsSorted = Form2[ID in IDs] sort by SortField;
  3. input.MultiSelectLookup = ???
I've tried:
  1. input.MultiSelectLookup = IDsSorted.ID.getAll();
  2. input.MultiSelectLookup:ui.add(IDsSorted.ID.getAll()); (or append)
  3. for each id in IDs
    {
         input.MultiSelectLookup:ui.add(IDsSorted.ID.getAll()); (or append)
    }
None of the ui:add or ui:appends work.

The others work, but they add the values in the sort order of the field "Lookup" from Form1 above.

SO weird, and neither I nor Creator Support can figure it out.
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方