Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Script Talk › Change in linking records in script
- This topic has 1 reply, 2 voices, and was last updated 1 day, 2 hours ago by
Brendan.
-
AuthorPosts
-
March 15, 2026 at 6:00 AM #53669
Mark MoranParticipantI’m not sure it’s the latest 1.1 update or the fact that I just restored from a backup. But this script used to create new record in another form and link it and display it immediately in the record. Now I have to go out of the record into the other form and then back for it to show up. Is it my script or has something changed in Tap Forms Pro?
function CopyToEbaySales() {
// — 1. CONFIGURATION —
// A. Source Fields (From COINS Form) – HARDCODED IDs
var coin_type_id = ‘fld-1231556e0f234de9b2d85f50225b8135’;
var year_id = ‘fld-4b84b047badd4d4cbb4a67ef6839522f’;
var mint_id = ‘fld-adb0be16f1a347dbbecc4ef562d779a7’;
var photo_id = ‘fld-d32730d871864ab2904cb60c587b105a’;
var purchase_price_id =’fld-6deb90149d2b494fa3a3e89236398857′;// B. Destination Fields (From EBAY SALES Form) – HARDCODED IDs
var ebay_coin_type_id = ‘fld-9fdddd3a7a47410394042488e730f6c0’;
var ebay_year_id = ‘fld-6bee0d6f1e2b413192715c2c807d526f’;
var ebay_mint_id = ‘fld-cc42485d28c14c99bbd4970619bee9cf’;
var ebay_photo_id = ‘fld-e4a157a02f4841dc845b3ce800565c8e’;
var ebay_cost_id = ‘fld-dfa5d5683deb466e9a8088d2d4db56a5’;// C. Link Field (From COINS Form) – DYNAMIC LOOKUP
// We get this ID automatically using the name.
var link_field_name = “Ebay Sale”;
var link_field_id = form.getFieldNamed(link_field_name).getId();// — 2. EXECUTION —
var ebayFormName = “eBay Sales”;
var ebayForm = document.getFormNamed(ebayFormName);if (ebayForm) {
// Create the new record in eBay Sales
var newEbayRecord = ebayForm.addNewRecord();// Copy the data
newEbayRecord.setFieldValue(ebay_coin_type_id, record.getFieldValue(coin_type_id));
newEbayRecord.setFieldValue(ebay_year_id, record.getFieldValue(year_id));
newEbayRecord.setFieldValue(ebay_mint_id, record.getFieldValue(mint_id));
newEbayRecord.setFieldValue(ebay_cost_id, record.getFieldValue(purchase_price_id));var photos = record.getFieldValue(photo_id);
if (photos) {
newEbayRecord.setFieldValue(ebay_photo_id, photos);
}// Link the new record back to the current Coin record
if (link_field_id) {
record.addRecordToField(newEbayRecord, link_field_id);
} else {
console.log(“Error: Could not find a link field named ‘” + link_field_name + “‘”);
}// Save
document.saveAllChanges();
console.log(“Success: Record moved and linked.”);} else {
console.log(“Error: Could not find form named ” + ebayFormName);
}
}CopyToEbaySales();
March 15, 2026 at 6:43 PM #53688
BrendanKeymasterTry using
document.saveAllChangesAndRefresh();That’ll refresh the record when you save.
-
AuthorPosts
You must be logged in to reply to this topic.