AnsweredAssumed Answered

Duplicating an Invoice and its LineItems?

Question asked by FranzLang on Jan 24, 2012
Latest reply on Jan 25, 2012 by philmodjunk

Title

Duplicating an Invoice and its LineItems?

Post

Hello,

I am using the following code (courtesy of jensteich) to duplicate an Invoice including its LineItems:

Go To Layout [ MAIN ]
#
# Search by relationship of all the children
Go To Related Records [ RELATED ; show only matching ]
#
# Jump back
Go To Layout [ MAIN ]
#
# Duplicate MAIN Record and store ID
Duplicate Record
Set Variable [ $ID ; MAIN::ID ]
#
Go To Layout [ RELATED ]
#
Loop
End Loop If [ Get( FoundCount ) = 0 ]
Go To Record [ First ]
Duplicate Record
Set Field [ ID_Main ; $ID ]
Omit Record
Go To Record [ First ]
Omit Record
End Loop
#
Go To Layout [ MAIN ] 

However, one little problem is that the "Amount" field of each LineItem is not duplicated properly. Instead, it is always set to "1", no matter what the original value is.

I figured myself that this is because I have "1" as an Auto-Enter value.

But how can I override this default and write the correct Amount into the duplicated LineItem?

Outcomes