Hi,
I’m trying to create a prompt that provides a selected value that I can then use to retrieve a value from a key/value dictionary. In other words, in the code below, if a user chooses “Inbox” from the prompt, I want var b
to now have the UUID value of dict.inbox
I don’t really understand JavaScript, I’m just cutting and pasting from other folks examples. Maybe this is the wrong way to go about this? At any rate, the code below isn’t working.
var locs = ['Inbox','Readings','Teaching','ReadingNotes'];
var t = Prompt.create();
t.title = "Save where?";
t.addSelect("loc","locations", locs,[""],false);
t.addButton("OK");
var didSelect = t.show();
// location dictionary
var dict = new Object();
dict.Inbox = "9BE1F258-EC8E-4A04-8331-6ED5D1A30D2E";
dict.Readings = "FC55AA1F-F6BA-4216-A589-302693ED8505";
dict.Teaching = "F396C26F-B4DA-47EF-B777-CE612805EFC0";
dict.ReadingNotes = "9D3A6BBD-0F68-4DB4-9A3A-B9EDF2F9B5D8";
//get value from prompt and translate to devonthink location uuid
var a = t.fieldValues["loc"];
var b = dict.a;