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 New Record in a related table

Featured Replies

Hello,

I have a file with two related tables: Jobs & Packing Slips. I currently have a script that allows me to create a new Packing slip/Record when I click a button from the Jobs table. Then I type in the corresponding Job Number from my Jobs Table into the Job Number field on my Packing Slip table, which then pulls in the rest of the values I need from my Jobs table onto my packing slip.

I'm wondering if it's possible to modify the script so that in addition to creating a new record for me, it also automatically pulls in the corresponding Job Number from the record in which I triggered the script from. I.e.: I'm in the record for Job# 123, I click the button to trigger the script to create a packing slip for this job, and Job #123 is already in the Job number field on my packing slip without me having to manually type it in.

I'm thinking this has got to be a pretty simple solution, but nothing is coming to me. Let me know if more clarification is needed and thanks much!

Script for New Packing Slip button on Job Entry Form

Set $jobID to __kP_JobID

Go to Layout Packing Slip

New Record

Set PackingSlip::_kF_JobID to $JobID

  • Author

Sorry, I'm very entry level. Would you please add a little more detail/clarification on setting up the script? I see the option to "set variable" but still am not sure how to do it...

Set Variable [ $jobID ; JobID]

Go to Layout [ layout based upon Packing Slip ]

New Record/Request

Set Field [ PackingSlip::JobID ; $jobID ]

Thanks, LaRetta. Sorry, mrsw, but I thought that would be enough and I only had a couple of minutes.

Behind this simple script is however, some fundamentally important concepts:

1. Your two tables are related by a primary key (JobID). By populating a foreign JobID key in the Packing Slip table, you are able to look back to the Job record from the Packing Slip record for the related Job data. In the relationship graph you should define a relationship from PackingSlip::_kF_JobID -> Job::__kP_JobID. The prefixes "_kF" and "__kP" are what I use to name foreign and primary key fields.

2. Variables are useful for capturing a value when you need to hold it in memory while you switch "contexts."

3. "Contexts" - where you are in the relationship graph. Are you in the "context" of Jobs or Packing Slips. So, when we say a layout "based on Packing Slip," that is in layout mode, you'll see that in the Layout setup, a table occurrence for Packing Slips is the basis of the Packing Slip layout. That is the context from which that layout will operate.

hth,

Barbara

  • Author

Thank you both so much! The script worked beautifully!

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.