Duplicating Portal Records with parent layout
I have been using this post to help me set up a script to duplicate the portal records when I duplicate the parent record; and it's been a huge help.
For the most part, it's working. But, rather than copying the portal records from the record I'm in when I run the script, it duplicated the current parent record details, but then is going back and grabbing the portal records from the first parent record I have. What part of the script to do I need to edit? (I also realize this is from around FMP 11, and I'm using 13 now, but didn't think that would matter).
I have a parent record for each group of students (groups A,B,C, for example). Then I have a tab with a portal that shows what their topic was on different days, along with the date (ie: 1/1/14; addition; 1/2/14; subtraction). When I create group A, I want to be able to duplicate everything- including the dates and topics because those are often exactly the same, I just see group B during a different time.
Everything in the script given seems to be working well, except grabbing the portals from the wrong parent. I've tried changing a few things, and just can't seem to get it to pull the correct records.
Thanks for any help!