Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have a table (table1) that is related to another table (table2) by its key. When a record is created in table1, a new record is created in table2. This is defined by their relationship.

 

I want the new record in table2 to have some checkbox fields auto-populated.I have tried using the auto-fill option for the specified fields in the related table, but it is not working. The only thing that seems to work is a script with some "Set Field" calls to those fields, but I have only found an "onRecordCommit" script trigger to run this, and I need to to run as soon as the record is created. Is there a better way to do this?

 

Thanks.

Posted

Auto-entry should work unless you have a reference to something that it cant grab the value for. What is your auto-entry calc?

Posted

Auto-entry should work unless you have a reference to something that it cant grab the value for. What is your auto-entry calc?

I am just entering data, not a calculation. Right now, as a test, I am just auto-filling with "1"

Posted

A child record will not be created automatically just by creating a new parent record unless in the script you can make it create a new child by setting a value in the child.

 

See attached.

child_create.zip

Posted

A child record will not be created automatically just by creating a new parent record unless in the script you can make it create a new child by setting a value in the child.

 

See attached.

But how would this script you reference be called? I want it to only happen when a record is created, and there is no "OnRecordCreate" script trigger.

Posted

Did you see the script? It would be called on Record commit for the parent layout, and only create one when there are no child records.


Furthermore, I still question why you are trying to do this...

Posted

Did you see the script? It would be called on Record commit for the parent layout, and only create one when there are no child records.

Furthermore, I still question why you are trying to do this...

No, I couldn't see the script because the file was read-only and I couldn't look in the script manager.

Could you type the script out here?

 

I think I understand what I need to do, but I can't figure out how to check if a matching related record exists. Also, if I modify a field in the related table with a key that does not yet exist, will that create a record with that key?

Posted

The file is not read only. Though perhaps you are unfamiliar with unzipping a compressed file?

Posted

Oh, duh. I am sorry, I was in a hurry yesterday and accidently clicked open the compressed folder to the file. DX

 

Thank you, mr_vodka, that script worked! While it does only work after a commit, and I'd prefer it to run as soon as a record is created, it should still be fine. Thanks!

This topic is 4180 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.