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

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

Recommended Posts

Posted

Hi. I have a field with a script trigger that passes 2 parameters to a script; 1) the name of a related table (as literal text), and 2) a field's object name. I use this script for different fields on different layouts and have so far been using "If" statements to decide what to do, e.g.:

 

If [Get ( ActiveModifierKeys ) = 16]

     If [$relatedTable = "People » Projects"]

          Go to Related Record [ From table…etc.]

     Else If [$relatedTable = "Company » Projects"]

          Go to Related Record [ From table…etc.]

etc.
     End If
End If
 
This all works fine, but obviously breaks if I change the TO name. I know I can pass the field as an actual field name (not literal text), but once it's in my script, how can I use that without testing using literal text? It seems I have to go through the "If" tests, and if that's true I'm not sure how to incorporate GetFieldName or something similar to go to the correct related table and layout.
 
Thanks for any help with this.
 
Michael
Posted

You could make this generic by not using a Go to Related Record script step, but going to a layout based on the target TO and doing an find.

 

It will require a strict naming convention where you would prefix layouts with the TO name so that you can construct the desired layout name easily.

 

In this scenario you would pass a field reference into your script and use the RelationInfo() function to find out what fields you need to use to make a find that mimics a GTRR call.

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