AnsweredAssumed Answered

Help Dublicate record with multiply portals

Question asked by hanstrager on Jan 22, 2013
Latest reply on Jan 23, 2013 by hanstrager

Title

Help Dublicate record with multiply portals

Post

     I have a problem with a script that should copy a record with multiply portals.

     I so far got the record copied and have it copy one of my portals with the following scripts

      

Set Error Capture [ On ]

If [ LeftWords(Get ( LayoutName );1) ="TECHNICAL" and not IsEmpty(Line Items::xLine items ID) ]

Commit Records/Requests

     [ Skip data entry validation; No dialog ]

Go to Related Record [ From table: “Line Items”; Using layout: “Line Items” (Line Items) ]

     [ Show only related records ]

Go to Layout [ original layout ]

Set Variable [ $Lines; Value:1 ]

End If

Duplicate Record/Request

If [ Get ( LastError )=200 ]

Show Custom Dialog [ Title: "Cant Dublicate"; Message: "You Don't have privileges to dublicate" & Lower(LeftWords(Get

     (LayoutName);1)) &

     "."; Buttons: “OK” ]

Else

If [ LeftWords(Get ( LayoutName );1) ="TECHNICAL" and $Lines=1 ]

Perform Script [ “dublicate lines from fabric ” ]

End If

End If

      

     And then use a sub script called “dublicate lines from fabric” with the following script:

      

Set Variable [ $ID; Value:TECHNICAL SHEET 2::xTechnical sheet_ID ]

Go to Layout [ “Line Items” (Line Items) ]

Freeze Window

Loop

Duplicate Record/Request

Set Field [ Line Items::TechSheetID_FK; $ID ]

Omit Record

Go to Record/Request/Page

     [ First ]

Omit Record

Exit Loop If [ Get ( FoundCount )=0 ]

End Loop

Go to Layout [ original layout ]

      

     In my naivety I thought I could just make another script and use “Perform script” and use the above script 4 times according to what portal I want to copy, but then obviously It makes 4 new records with a copied portal on each.

     How do I make the above script to make a duplicate of a record from TECHNICAL SHEET 2 which includes different line items in my portals (a portal for fabric, zips, buttons, other)?

Outcomes