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.

Create Related Records on a Locked Master Record

Featured Replies

Hi. How could I prevent users to create new records in a related file when the master record is locked?

Example: An invoice locked on a record-by-record basis contains several items in a portal. The related records (details) are also locked by a calculation field related to the master record. The user can not modify the master record or the related records, but can create new related records, modifying in such way the master record. Thanks in advance for any help! [color:"black"] [color:"blue"]

disable access to the related file (by not providing a layout, for example)

  • Author

Thanks for your answer cjaeger, could you be more explicit? I don't quite understand

What do you not understand?

Do you know something about passwords and groups in FileMaker?

  • Author

If I disable access to the related file, users will not be able to create new Invoice Details in new unlocked Invoices.

Users should be able to create, modify and delete any Invoice or Invoice details until the master record and the related records are locked by a script. When those records are locked, users are not allowed to modify or delete them, but they could anyway create new records in the portal in the Invoice Layout. The question is: How to disable access to create new records in the portal when the Invoice is locked?

I know something about passwords and groups. If you know the answer please help. Thanks.

Hi Ed,

I think the best thing you can do is turning off the 'Allow creation of related records' function in the relation definition for the invoice details. You still can create new records in the details database via a script if you turn that option off. If the portal does not update after creating a new detail record via the script, try 'setting' the field on the left side of the relation to it's own value at the end of the script. Mybe an extra 'exit record' script step will do the trick as well...

Hope this helps!

Regards,

Ernst.

Hi,

You can still use a validate by calc on each field used in the portal with calculation Master:Locking key = yourvaluelock

Also set it to be strict with message.

Users would still be able to create a new entry, but they couldn't proceed filling new related record datas. You'd end up with a Unique_Id created in the related file, and the auto-filled Foreign Key.

As nothing else in that portal would have been filled except the auto-entered ID, you could hunt this empty record.

This could be done this way.

Create a stored calc in the related file :

HuntEmpty = Case(IsEmpty(SomeFieldInPortal), "empty" & Master_ID,"")

This calculation would have its counterpart in the Master :

MatchEmpty = "empty" & Master_ID

Create a relationship HuntEmptiesRel = MatchEmpty::HuntEmpty

Then include the following script to each other Navigation Script (go to next/previous/last/first record) :

If IsValid(HuntEmptiesRel)

Show Message ("There is an empty record in the related file, please delete it")

Go to Related record (HuntEmptiesRel- show only)

External script (delete)

Refresh

GoTo Next/Previous...

Else

Goto Next/Previous....

This is the method I use, and a quite similar method is used and discussed, as long with a sample (the second one) here.

Disabling Allow Creation at the Fly

(Try entering data in the "some text field" and check the script "New Line by script")

Now, the easiest would be to have each field in the portal be a button with script

If Locker = OK

Go to field

Else

Show Message

HTH

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.