I have three tables/forms:
"Franchise" lists details about each franchise, including Franchise_Name.
"People" lists details about each person, including the lookup field Franchise, which looks up from Franchise_Name in the Franchise table.
"Call_Record" which a person completes when they make a sales call. It contains their name in the Caller field (which is inserted automatically by matching zoho.loginuserID against email addresses in People and then extracting the person's name). I also want to include their franchise(s). It is possible for one person to belong to than one franchise, so the field has to be a pick-list of some kind. Each Call Record will be on behalf of only one franchise even if the person belongs to more than one.
This code gets the default user name and puts it in the Single Line field 'Caller':
namelist = People[Email == zoho.loginuserID];
name = namelist.Full_Name.getall();
input.Caller = name.toString();
(I actually have to do a bit of work on the variable 'name' to remove any multiple occurrences but that doesn't affect my problem here.)
Now I want to populate a lookup field 'Franchise' with the one or more franchise names that the person belongs to. But if I use the command...
Franchise:ui.add(namelist.Franchise.getall();
... it adds the ID of each matching franchise record to the pick-list field 'Franchise', not the franchise name.
I am sure I can create another list similar to namelist that contains franchise name for each franchise ID and then use that to populate the pick list, but I have now tried every variation I can think of and I'm getting nowhere. (It doesn't help that in the Deluge documentation it explains things like the "for each" construct and then gives example coding which has nothing to do with the explanation!)
I just wasted two days and I need a beer.
Can anybody help me out here? (code, not beer) My gratitude will know no bounds. :)