mark_b

What is best apporach to duplicate a set of nested portals

Discussion created by mark_b on Feb 19, 2015
Latest reply on Feb 19, 2015 by bladeomatic

Greetings,

 

I can't get my mind around this like I used to.  I have a parent record that has related records displayed in portal-A.  By using OnObjectEnter script triggers, when a row is selected in Portal-A, another set of records related to the Portal-A record are displayed in Portal-B.  And again, when a row is selected in Portal-B, a 3rd set of records related to the Portal-B records are displayed in Portal-C.  None of the portal tables will have more than 10 to 15 related records.  What needs to happen is to duplicate the original parent record and duplicate all of the children in the related portals.  I think this will involve 3 nested loops, where I get the UUID of the parent, duplicate or export/import each level of children and update/replace the links to prior level.  But this is where I bog down.  In theory it sounds easy, but the execution eludes me.  I have seen examples where a blank global field is included in a relationship - what some call an "Obligatory Create", and a loop walks through one set of children and creates duplicates by clearing the global field at each loop iteration and setting a field in the child table.  But then how do I use that technique to duplicate the children from the records that were just created. I feel that an export/import would be better because I could use the replace field option for the related key values.  I feel I'm going in circles and becoming a bit loopy.  Any guidance would be much appreciated.

 

Regards, Mark

Outcomes