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.

adding a new record and relating it to another

Featured Replies

Hi,

I want to make a button that will open a second window, add a new record, but place the current record (from first window)'s ID in a field. It tried to script it using the SET FIELD,... with field::fieldID, but it doesn't work, can anyone help me out?

Basically I am trying to avoid turning the create records in portal situation.

lj

the button above the portal would be "Add Line Item" and would:

Set field (globalfield to current records's id)

New Window

Go to Layout (layout based on table occurrence for the line items)

New Record

Set foreign key field to globalfield

Are you showing the user a popup where they enter the line item info?

  • Author

Yeah, I wanted to make a popup window when they click the "add line item" button. I'll try to do what you suggested (if I can figure it out). I'll let you know in a few... thanks!

  • Author

Worked like a charm! My question now is, why didn't my way worked? I tried basically same thing... does it have something to do with the way a global field works?

I just tried to set field foreign key = primary key of 1st table, but it was a no go...

You suggest the same thing except by transfering the primary key to the global field and it works! must have to do with globals!

Thanks Very Much!!!

Lonesomejubilee

Yours didn't work because when you open the new window, the context changes, and from the new window, FM doesn't know what value to use. BTW, you can set up your button to pass the ID as a script parameter, and not use a global field.

Your script then might be:

If [get(ScriptParameter <> "" /* prevents empty record creation */]

New Window

Go To Layout["My Layout"]

New Record []

Set Field [iD, Get(Scriptparameter]

Commit Record[]

End if

David

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.