Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

"Go to related record" after deleting current record?

Featured Replies

  • Newbies

Hello,

I'm very new to FM although I do have extensive SQL skills(maybe that's why I'm not really getting anywhere with FM).

Anyway, I have a database with a Parent-Child(one-to-many) relationship between two tables, one for Bank Accounts, and one for Transactions. On the transaction form, I have a button to execute a script. What that script does is to:

1. delete current record

2. go to related record(in this case, the bank account the record -- the record that has just been deleted -- belonged to)

The script works fine when there is more one transaction in a bank account(I think it's because even the current record has just been deleted, there are still other transaction left for the relation to work). However, when there is only one transaction left, after deleting the current record, there is no more record left to make the relation, and I can't get back to the related bank account anymore.

So, is there anyway(using variable or not, ...) to "remember" what the related record was before, delete the current record, then go to the related record?

Thanks

First execute the GTRR to select the correct parent record, go back to the child and then delete it. Finally simply change the layout back to the parent.

Jens

Edited by Guest

You might try it the other way around:

Go to Related Records [ Show only Related Records ; layout: Child Layout ]

Go to Layout [ Parent Layout ]

Delete Record []

Go to Layout [ Child Layout ]

Or you can capture the parent RecordID, delete the parent, then navigate to the child layout and perform a Find for those child records with that parent RecordID as the foreign key.

  • Author
  • Newbies

Thanks for all your help!

I got the script working as follow:

Set Variable [ $parentRecordID; Value:transaction::account_id ]

Delete Record/Request

Go to Layout [ “account” (account) ]

Enter Find Mode []

Set Field [ account::id; $parentRecordID ]

Perform Find []

You can also set up the relationship so that when a parent record is deleted, the child records are automatically deleted. But, you need to be careful with that option.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.