Page 1 of 1

Duplicate Bid

PostPosted: Thu Nov 18, 2010 7:57 pm
by ZoogDev
I'd like the ability to duplicate an entire bid.Perhaps this is already possible.

Anyone know how this may be done?

Thanks
Z

PostPosted: Fri Nov 19, 2010 4:52 pm
by John Sindelar
Hi Z,

You'd need to write a script for this as there isn't one already. Let me know if you get stuck and I'd be glad to help.

John

PostPosted: Sat Nov 20, 2010 2:28 pm
by ZoogDev
Thanks John,

I seem to be stuck hard. I'm fairly new to FM Dev, scripting has yet to become natural and I am unfamiliar with the separation model that Seedcode is using.

Can you point me in a good direction here :?:

Thanks for your support-
Z

PostPosted: Sat Nov 20, 2010 3:09 pm
by ZoogDev
Addition to previous post.

I can script my way to the related Bid in the ProjectBids Table however I can't seem to pick up the Bid ID for duplication. SO my duplicate record is based on the Project ID. I've tried about every step I can think of. :?:

Thanks again-
Z

PostPosted: Sat Nov 20, 2010 6:31 pm
by John Sindelar
Duping entities with related records tends to be a logic problem, more than about tricky calculations. So I generally do it like this:

1. Use GoToRelatedRecord to go to the bid on the ProjectBids layout. From the bid go to the related line items: this Go To Related Record makes them the found set.

2. Return to the bid layout. Duplicate the bid.

3. Store the ID of the new bid in a global variable or global field.

4. Move to the ProjectBidLines layout where your found set is waiting.

5. Sort these in reverse serial number order.

6. Go to the last record.

7. Start your loop. Dupe the record and set the new bid ID in from your global variable or global field.

8. Call the omit record step twice: leaving you again on the last record.

9. Exit your loop when the Found Count is zero.

10. End your loop and return to the bid layout.

The only trick here is the reverse sort. We do this so our newly created bid items have the same creation order as the ones in the bid we duplicated.

Hope that helps,

John

PostPosted: Sat Nov 20, 2010 11:28 pm
by ZoogDev
John Sindelar wrote:Duping entities with related records tends to be a logic problem, more than about tricky calculations. So I generally do it like this:

1. Use GoToRelatedRecord to go to the bid on the ProjectBids layout. From the bid go to the related line items: this Go To Related Record makes them the found set.

2. Return to the bid layout. Duplicate the bid.

3. Store the ID of the new bid in a global variable or global field.
Haven't had any luck with this. Can you suggest some script steps that might accomplish this?

4. Move to the ProjectBidLines layout where your found set is waiting.

5. Sort these in reverse serial number order.

6. Go to the last record.

7. Start your loop. Dupe the record and set the new bid ID in from your global variable or global field.
again, I'm stuck here.

8. Call the omit record step twice: leaving you again on the last record.

9. Exit your loop when the Found Count is zero.

10. End your loop and return to the bid layout.

The only trick here is the reverse sort. We do this so our newly created bid items have the same creation order as the ones in the bid we duplicated.

Hope that helps,

John


Thanks for the support-
Z

PostPosted: Sun Nov 21, 2010 7:54 pm
by ZoogDev
I'm also attempting to add Bid Lines 'allow creation of records via relationship' in the bid lines portal. This works for the first Bid however, subsequent bids do not.

We create many bids daily, some with hundreds of line items. Click the +new button is so inefficient.

I can get a OnObject script trigger to do the work but then we can end up with a lot of extra lines to delete when one goes back to modify a line.

Any advise is greatly appreciated.

Thanks
Z

PostPosted: Sun Nov 21, 2010 8:01 pm
by John Sindelar
Allow creation of related records doesn't work on filtered portals, unfortunately. If you really make that many lines, you could write a script that offers a custom dialog asking how many lines to create (50?) and the makes as many blank lines as you need: you the tab through entering data.

PostPosted: Wed Nov 24, 2010 10:20 am
by ZoogDev
I can duplicate the bid record however, I'm having difficulties applying the correct script steps to duplicate all the bid lines. Here's a screen shot of my script. Highlighted area is obvious failure point. I've tried both global variables and global fields to store the Bid ID.

Image

Any assistance in identifying the correct scripting would be helpful and appreciated.

The ability to duplicate bids [to accommodate quick revisions] would be a great feature upgrade. For us anyway. :D
Perhaps it's not widely utilized.

Thanks
Z[/img]

PostPosted: Sat Nov 27, 2010 10:30 am
by John Sindelar
Hey Z,

Take a look at the attached script. Note that we record the newly created bid's ID into the same global field we use to hold the selected bid after the comment "Select the new bid". This not only selects the new bid so the user has it highlighted, but gives us a place to store the bid's ID so we can use it later after the comment "Set the new bid ID".

Note that you could use the same logic to dupe an Invoice except that we don't "select" invoices the way we do bids: we're either on an invoice record or we're not.

Hope it helps.

http://www.seedcode.com/support/images/ ... upeBid.pdf

- John

PostPosted: Sat Nov 27, 2010 9:07 pm
by ZoogDev
Thank you John!

The script works beautifully.

Your responsive support is as amazing as your product. Both have far exceeded my expectations. :D

I look forward to utilizing more of your products soon.

Thanks again-
Z

PostPosted: Sat Nov 27, 2010 9:35 pm
by John Sindelar
Thank YOU, Z!