AnsweredAssumed Answered

[SCRIPT] Create Records in a Related Table (getting data from another Related Table)

Question asked by valeriorrrr on Dec 27, 2011
Latest reply on Dec 28, 2011 by philmodjunk

Title

[SCRIPT] Create Records in a Related Table (getting data from another Related Table)

Post

Hi, I have a layout for some related tables, B related to A and C related to A too (I have a portal that displays the related records of C).

I need a script that gets all the related (to the current record of A in the layout) records of B and for each record it creates a related record in C (using the data from B to populate the fields in the new records).

The first problem I'm facing is the fact that when I use 'Go to related record' my window layout changes (getting the layout of B to display the records) even tough I set 'Freeze Window' before. The second problem is that it seems that I can't loop through all the records from B but only get one. The third problem is: how can I create a related record in C from a script?

 

Here is a version of the script I'm using (translated from my language into english):

Freeze Window

Go to related Record(Show only related records; from table: "B", with layout: "B")

Go to record/request/page [first]

Loop

Go to layout [C]

new record/request;

setField[C::x; B::x]

save records;

Go to record/request/page [following; exit after last]

End Loop

Outcomes