2 Replies Latest reply on Nov 26, 2016 1:34 PM by ezeitgeist

    Related record as a find script step?




      I currently have a solution that begins in a User layout (Dashboard), and has a button that triggers a "Go to Related Records" in a related table based layout. Then a script runs OnLayoutEnter. This script runs a Find Matching Records [ Constrain ] function (Constraining by UserID match of records in a different table related to the User -- meetings User attended), and then has a number of following steps (relating to PDF creation).


      IF I just run the Find Matching Records WITHOUT the Go to Related Records happening first, it shows ALL the records, which I definitely don't want. The problem I have is that I am using WebDirect and integrating in the robot that creates a PDF for users and I cannot have the "Go to Related Records" button, it must be integrated INTO the OnLayoutEnter script.


      How do I add that Go to Related Records aspect into the one script?

        • 1. Re: Related record as a find script step?

          The results of any GTRR can be reproduced with a find. That might be very simple or very complex to do.


          If you have a one to many relationship that is the basis for your GTRR, the you can set a variable to the current Primary Key value before you change layouts. This might be done via a global variable and OnRecordLoad on the layout you are leaving to enter this one or a navigation button that changes layouts for the user can perform a script that captures this value before changing layouts.


          Either way, you script can now enter find mode and set the foreign key on your new layout's table to the value of this variable and perform the find. (of course, if you are using a navigation button to change layouts, it can simply do the GTRR each time so you might consider just using navigation buttons to control which layout a user accesses.

          • 2. Re: Related record as a find script step?

            That is perfect, I already have a $$UserID set from login. Thank you!