Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

needing to autofill a portal field...


This topic is 6087 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

ok, i have a table that holds all of my customer's data (name, address, and id) i have another table (linked by id) that holds a 'call history' that has the following fields:

id

date

time

call notes

contact name

technician

now...i have a layout designed that has a portal inside of it to show all of the call history for that customer. my problem is that i want it to automatically fill in the "id" field with the value of the "id" field in the customer info table. is this even possible?

Posted

You can either set the field when a new record is created by a script or you can turn on "Allow creation of record on the child side of the relationship.

  • 2 weeks later...
Posted

ok...but what would the script need to be? because i already have the child settings set in the relationship. it still isn't working.

Posted

Perhaps you're missing a key field? In the Customers table you need __kP_CustID (number, auto-enter, serial, can't modify), and in the CallHistory table you need a foreign key _kF_CustID (number).

Your relationship will match Customers:B)__kP_CustID=CallHistory::P_kF_CustID.

If you set the child side of the relationship, the Call History side, to Allow create, the call record will automatically have its _kF_CustID set when the record is created. Any matching key is automatically set.

mr_vodka mentions a second approach to accomplishing the setting of the foreign _kF_CustID by using a script. Many people chose this method because they do not want users to directly edit a portal row, hate the last "empty" portal row interface, etc.

The second method is to create a "New Call" button and place it above your portal. This button runs this script:

(pseudo-code)

Set Variable $CustID to __kP_CustID

Go to layout CallHistory

New record

Set Field CallHistory::_kF_CustID to $CustID

Go to layout Customer

Now, with field behavior set to Browse/Find on, your users can edit the call history record directly in the portal, but they cannot add a new portal row unless they click the "New Call" button.

To get fancy, you could create a data entry layout for the new call and change the above script a bit:

Set User Abort Off

Set Variable $CustID to __kP_CustID

New Window (size it smaller so it floats above the Customer window)

Go to layout CallHistory_popup

New record

Set Field CallHistory::_kF_CustID to $CustID

Pause

Close Window

You need to have on your popup window, a button that is set to Resume script.

This topic is 6087 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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