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.

"Allow Creation" vs. record creation via a script?

Featured Replies

Hi there!

This may seem like a totally obvious question, but I've read the internet, and it says that "Allow Creation..." is for use, basically, only with portals.

But what if the related table, where you want to make a new record, is not one with any fields on the layout? Can you use the relationship to create new records via a script, or is that just another one of those "don't try that, it's stupid" kinda things? I'm thinking it <is>.

Is there no way to use the "Allow Creation..." trick to create records via a script? I mean, other than having the script "Set Field" (or "Set Field By Name") in a portal?

( I know you can do it without a portal, and that it's, basically, pointless. If you're going to have those fields on the layout, go ahead and put 'em in a portal. No problem. Works. )

So let's say I want to be able to create a new, related record via a script. The two choices are:

a) make the portal you need and use it to create records by using "Set Field", or

use "New Record/Request" to create the record, and then use variables to paste in the match field data.

Is that correct?

Thanks so much!

You have it worked out. Ue a script if you need to create a related record where there are fields not showing in the portal.

"Allow creation" permits record creation in a portal without using a script.

Ue a script if you need to create a related record where there are fields not showing in the portal.

Not having fields showing in the portal is not an obstacle to creating related records through a relationship; for example, you can do:

Go to Portal Row [ Last ]

Set Field [ Child::HiddenField ; <anything> ]

...

Whether it's a good idea is another matter.

So let's say I want to be able to create a new, related record via a script. The two choices are:

a) make the portal you need and use it to create records by using "Set Field", or

use "New Record/Request" to create the record, and then use variables to paste in the match field data.

Is that correct?

Not entirely. There are several methods to script the creation of related records through a relationship (not necessarily through a portal). However, since script variables were introduced in version 8, you will find it hard to justify using any of these methods - as opposed to going to a layout of the child table and creating a new record there.

  • Author

Thanks so much, both of you. This is very helpful.

Whether it's a good idea is another matter.

I don't know whether that statement is meant to be ironic, but if I could ask, without sounding like a total idiot, is it always a not(good) idea, or only sometimes?

I guess I really don't care though - by which I mean: my goal is not to learn every intricacy at this point, but to learn the basic best practices at my level. It appears that I've found the best practices for a newbie here, but part of being a newbie is that you may not recognise the good stuff when you see it (or write it). So, thank you both, again, for your help. :)

Sincerely,

tzf

is it always a not(good) idea, or only sometimes?

It might be a good idea if - for example - the purpose of the script is to assist the user during data entry. But when your purpose is to create/modify data, it's best to work entirely at the data level and not to rely on the existence of any layout element. Ideally, your script should still work even if all the layouts in the file are completely empty.

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.