Search Results for 'script'
-
Search Results
-
I have a form called “Order” where I store stuff I order online. It has a child record called “Shipments” which store shipments. I often want to quickly add a new shipping record and use this as a form script with the prompter to add in a new shipment record with the tracking ID and carrier set. It also will set the shipping date based on the order record if it’s already set or default it to the current date.
This uses the prompter for user interaction (including leveraging a pick list) and
addNewRecordToFieldfor adding a new record to a Link to Form field. It also demonstrates usingsetFieldValuesto bulk set values and also usesJSON.stringifyto dump out debugging information withconsole.log. Here’s a screenshot of the prompter:
Field names are at the top, replace with ID’s matching your fields.
// Order: Shipment Field ID var shipments_id = 'fld-db2fcdb4d79c466ea09671c47d2ae645'; // Order: Ship Date var ship_date_id = 'fld-6ab700ccc11d418fbd27d8899d00c7a9'; var ship_date = record.getFieldValue(ship_date_id); // Shipments: Record Field ID's var tracking_number_id = 'fld-c487390743c947969cbe661cff596855'; var carrier_id = 'fld-0950c430cb0c41f79c51d43a544b366b'; var shipping_date_id = 'fld-1aa32f17e059424fb4e24bf894b34fdf'; var callbackFunction = function() { if (tracking_number && carrier) { var data = { [tracking_number_id]: tracking_number, [carrier_id]: carrier, }; if (ship_date) { data[shipping_date_id] = ship_date; } else { data[shipping_date_id] = new Date(); } console.log(JSON.stringify(data)); var shipmentRecord = record.addNewRecordToField(shipments_id); shipmentRecord.setFieldValues(data); document.saveAllChanges(); } }; let prompter = Prompter.new(); prompter.addParameter('Tracking Number', 'tracking_number', 'text') .addParameter('Carrier', 'carrier', 'picklist', 'Carrier - Shipments') .show('Message prompt', callbackFunction);Hey Everyone,
It was suggested to me that it would be a good idea to have a separate Scripting forum on my website.
Well, here it is.
This is the place to be if you want to post useful scripts to make Tap Forms do things you never thought possible.
If you’re unfamiliar with scripting in Tap Forms, please see the Scripting topics in the online user manual here:
https://www.tapforms.com/help-mac/5.3/en/topic/scripts
and the Tap Forms specific JavaScript API docs are here. These are the functions you can call within a Tap Forms script that do things specific to Tap Forms, such as fetching a set of records, reading field values, setting field values, and updating the database.
https://www.tapforms.com/help-mac/5.3/en/topic/javascript-api
It’ll be great to see what kinds of scripts you can come up with to make Tap Forms more powerful than ever.
Thanks!
Brendan
Forum: Script Talk
The place to be if you want to talk about Scripting in Tap Forms 5.Topic: Watched TV Shows Template
Hi Brendan,
Sorry if this is the wrong place to put this, but I am using the Watched TV Shows Template, which is exactly the thing I am looking for it’s just that the script doesn’t do anything, at least that is visible to me.
I have generated my api key and have pasted that in the script in TF.
Now when I run the script it asks for a IMDB URL which I paste in (example for The 100 would be https://www.imdb.com/title/tt2661044/ but then the script does not seem to do anything after that.Is there something I am missing.? The script console shows no messaged either. Any help would be appreciated.
Thanks
Andrew