Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8215 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I want to put a button on my Purchase order form to create a duplicate record. My form is related to another file for line items, which I input through a portal. The problem is when I duplicate a record none of the portal items show up. Is it possible for FM to duplicate the contents of a portal too, or do I have to avoid using the portals?

Posted

You need to duplicate both the master record and the related line items records ...

Perfectly doable, a bit convolute ... the script would look like:

Set field (gID, OrderID)

//Note: this is the "original" OrderID, OrderID is a unique serial number,gID is a global field

Duplicate master record

Go to related record (Show, Relationship to line items linking gID::OrderID)

//This selects the line items belonging to the "original" OrderID

Set field (gID, OrderID)

//Note: this is the "duplicate" OrderID

Perform external script in Line Items, see below

Go to record [Last]

Loop

Duplicate record

Set field (OrderID, Relationship to Orders::gID)

//This steps puts the "duplicate" OrderID in the duplicate line item record

Omit Record

Omit Record

Exit Loop If (Status Current Found Count < 1)

End Loop

Posted

Hey thanks for the help. A little daunting seeing as I've never actually done a script, but I tried it out. I think I got it except I got hung up on one action:

Exit Loop If (Status Current Found Count < 1)

FM would not allow me to type it this way "not recognized as a flag" or something like that. Maybe I should read a book.

Posted

Thanks again. It almost worked this time. It copied everything 3 times. I guess I'm having a problem with relationships (with my database that is). Right now I have a relationship between PO.fp5 (the master file) and line items.fp5 (related file) with the two joined on a field called PO Number (Auto-serial). Do I have to create some more relationships to the new global field created in PO.fp5?

Posted

You've just to make a new relationship between the global field and the PONumber in LineItems ... check the script in LineItems and see if you're omitting both the original record and its duplicate ...

This topic is 8215 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.