Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Prompter issues since 5.3.8 (973)
- This topic has 10 replies, 3 voices, and was last updated 4 years, 11 months ago by Sam Moffatt.
-
AuthorPosts
-
December 14, 2019 at 3:10 PM #38711
MarcusParticipantHi,
having issues since 5.3.8 (973) on iOS (iPhone):
I am in the record edit view, calling the script below with Prompter, it returns ‚undefined‘, but the field has a value:
function Test(){ var res = record.getFieldValue('fld-6f8227dc16204bd19dfb062a3dec8dc8'); Utils.alertWithMessage('Test', res); } var Note; let prompter = Prompter.new(); prompter.addParameter('Note ?', 'Note', 'popup', ['Test 1', 'Test 2', 'Test 3']) .show('Message prompt', Test);
By executing without prompter I get the correct field value.
function Test(){ var res = record.getFieldValue('fld-6f8227dc16204bd19dfb062a3dec8dc8'); Utils.alertWithMessage('Test', res); } Test();
I don‘t believe my script is wrong because it worked as expected in the past.
December 14, 2019 at 6:59 PM #38717
Sam MoffattParticipantDoes
record.getId()
change between the main script and the async prompter callback?December 15, 2019 at 12:38 AM #38722
MarcusParticipantNo, the ID doesn‘t change.
December 15, 2019 at 8:05 PM #38749
Sam MoffattParticipantI tried to do something to see if I could play with it but I ended up with it not even displaying a prompter on iOS 973 whilst it works perfectly fine on the desktop (2108).
December 15, 2019 at 9:51 PM #38755
Sam MoffattParticipantCopy of the script:
var clipboard = Utils.copyTextFromClipboard(); if (clipboard) { clipboard = clipboard.split("\n")[0]; } var tracking_number_id = 'fld-c487390743c947969cbe661cff596855'; var received_date_id = 'fld-e3e3539ee04f4cc7971c7098c572104d'; var confirmed_id = 'fld-2adb9ba8cdd048bbbb614d46b415ada5'; var alternate_tracking_numbers_id = 'fld-cf8718051bea4cc2aba0069ae76f32b7'; var alternate_tracking_number_id = 'fld-7342203d8f36415191bf8419fb6f70dc'; var callbackFunction = function(continued) { if (continued) { let newRecord = form.addNewRecord(); newRecord.setFieldValue(tracking_number_id, clipboard); newRecord.setFieldValue(received_date_id, new Date()); newRecord.setFieldValue(confirmed_id, true); document.saveAllChanges(); } }; function findRecord() { var targetRecord = null; MainLoop: for(candidateRecord of form.getRecords()) { if (clipboard == candidateRecord.getFieldValue(tracking_number_id)) { targetRecord = candidateRecord; break MainLoop; } for (alternateRecord of candidateRecord.getFieldValue(alternate_tracking_numbers_id)) { if (clipboard == alternateRecord.getFieldValue(alternate_tracking_number_id)) { targetRecord = candidateRecord; break MainLoop; } } } if (targetRecord) { targetRecord.setFieldValue(received_date_id, new Date()); targetRecord.setFieldValue(confirmed_id, true); document.saveAllChanges(); form.selectRecord(targetRecord); return "Updated existing record for " + clipboard; } else { let prompter = Prompter.new(); prompter.cancelButtonTitle = 'No thanks'; prompter.continueButtonTitle = 'Create record'; prompter.show("Unable to find matching record for " + clipboard, callbackFunction); return "Unable to find matching record for " + clipboard; } } findRecord();
December 16, 2019 at 2:46 AM #38780
MarcusParticipantDid you execute your script from the “script edit” mode ?
From there Prompter did not show anything for me since I’m using it…I my case the Prompter appears from the list or record edit view, but eg. getFieldValue returns “undefined”
December 16, 2019 at 3:25 AM #38788
BrendanKeymasterCan you post your form template so I can investigate? Or email it to me if you prefer.
December 16, 2019 at 3:28 AM #38789
BrendanKeymasterActually, it seems like the Prompter isn’t working from the Script Editor. But it does work when you run it from the list of Form Scripts.
December 16, 2019 at 3:46 AM #38793
BrendanKeymasterI’ve fixed this for the next update.
December 17, 2019 at 9:30 AM #38811
MarcusParticipantThanks ?
December 17, 2019 at 9:37 PM #38826
Sam MoffattParticipantWorks for me too, thanks!
-
AuthorPosts
You must be logged in to reply to this topic.