0

I have a custom button on the order called Clone with Products. what it does:

  • Clone the order
  • Modify some order fields
  • clone the LineItems

Now I want to add a function to it so it will also modify the LineItem fields.

The URL hacking looks like this:

/{!Order.Id}/e?clone=1&retURL=%2F{!Order.Id}&cloneli=1&00N4E00000E9qFF=&00N4E00000E9qFE=&00N4E00000E9qFG=&saveURL=%2Fapex%2FCloneWithProductsAfterSave

My question: is there a way to modify the LineItem fields using URL hacking. if not, I am thinking of either use flow or a before insert trigger on LineItem to modify the fields. pros and cons on each? love to discuss.

1

Just checked my clone with products button and it does it the same way. As you know the url hack is rough because you have to hardcode every field you want to null/change else it carries over the value in the clone.

I have before insert trigger on OLI that sets some things for me so you can go that route. We actually got a product called Convert Anything from a 3rd party implementation partner that I've started to use more. You can map what fields you want to carry over and in the mapping table you can modify the field with a formula or basic math or transformation for any object not just Opportunities.

We do subscription contracts so when an Opportunity is closed won we'll 'clone' with CA, it transform some fields on both the Opp and OLi, I do a lot of formula fields that recalculate the start date and end date and price and then I map those to new cloned start date and call it a renewal.

I'd recommend getting something like that, out of the hack game and more of a programatically setting what you need and not having to worry about adding ids for the fields that you don't.

  • Hi Dan, you probably did it in the neatest way. I will definitely use a mapping table when our clone is getting that complicated. I don't like url hacking either, but I love the simplicity of doing it. :) thank you for reply – Lee Sep 8 '17 at 4:29
0

I use the isClone() to identify it's a clone action on the LineItem and modify the field in the before insert trigger. it does the job but not ideal because not tidy enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.