September 17, 201114 yr This is a troubleshooting question: In one of my files there is a Company table and a Contact table. Each table has it's own form-type layout. The table occurrence group for the Company form also contains an instance of the Contact table in a one-to-many relationship. The Company layout contains a portal to the instance of the Contact table in it's TOG. As well as fields from the Contact table, the Contact portal contains a button that, when clicked, runs a script which accepts a parameter indicating the child entity (in this case, Contact). When the user clicks on the button in one of the Contact portal records, this script uses the Go to Related Record script step to take the user to that record in the Contact form layout. I've used this technique in two other projects. In fact, I copied the entire Company form layout with Contact portal from another project. The portal displays all the child records correctly. The problem is that, no matter on which Contact record the user clicks, when the script takes the user to the Contact form layout it always displays the first record, related to the current Company record, that was added to the Contact table. For example, if three Contacts named John, Jane and Fred are related to the company Acme Tool and Die and Jane was the first contact added, no matter which portal row in which the user clicks the button, the user will be taken to Jane's record in the Contact form. As a test I've noted the primary key values of three Contact records related to a specific Company. I've stepped through the Script Debugger and watched how, no matter which Contact record the user chooses, the same Contact::ID field value is always the current Contact record. I'm racking my brain trying to imagine what's causing this and not getting any closer to the solution. Everything seems to be exactly the same as the project from which the forms were copied. I know I'm going to be really embarrased when I learn what I've done wrong but can anybody suggest what the problem may be?
September 17, 201114 yr What are the settings in your script step Go To Related Record[], particularly what is checked at the bottom? Also please tell me the name of the table occurrence to the portal (you can see it when viewing the portal in layout mode).
September 17, 201114 yr Author My naming convention gives every table occurrence in a TOG the same 3-character prefix. The Company form TOG uses the prefix CPY. The main table is CPY|Company|Company. The portal is associated with the table CPY|Contact|Contacts. In the script: GTRR from CPY|Contact|Contacts Show records using layout CON_Contact_Form Result Options: Show only related records - Match current record only
September 17, 201114 yr It is crucial that when go gtrr from a parent to a portal record, you have the button completely in the portal row and you do not commit the record before the gtrr. Post the full script so we can see if somehow you've popped out of the portal row before the gtrr.
September 17, 201114 yr What you describe should work. Why don't you make a copy of your file, remove everything not related to the problem and post it here?
September 17, 201114 yr I don't see this technique "Contact portal contains a button that, when clicked, runs a script which accepts a parameter indicating the child entity " in your script. Where's the get (scriptparameter) or conditional gtrr? My money's on the extra commit records, lol.
September 17, 201114 yr Author What you describe should work. Why don't you make a copy of your file, remove everything not related to the problem and post it here? OK but, since this worked previously, I imagine that, when I strip it down to basics, it'll work again. I suppose that's what I should have done at the beginning rather than waste everybody's time with this thread. I'll let you know what I find out.
September 17, 201114 yr Author I haven't posed file to this forum ofen before. Did my previous post contain the expected attachment?
September 17, 201114 yr I imagine that, when I strip it down to basics, it'll work again. Well, if that's so then work slowly and check the result at each step.
September 18, 201114 yr Author It is crucial that when go gtrr from a parent to a portal record, you have the button completely in the portal row and you do not commit the record before the gtrr. Post the full script so we can see if somehow you've popped out of the portal row before the gtrr. My script did issue the Commit Records script step first. That was the problem. Why can't you issue the Commit Records script step before GTRR?
Create an account or sign in to comment