I want to use Clone button in opportunity. There is also a Clone with related.

I want to create a trigger in apex which can have different behaviour deending if user click on Clone or Clone with related. How can I can catch the clone method?



I suggest that you simply cannot differentiate the two cases. Related records must be created AFTER the parent record creation has been finalised, since they require the parent's ID. As such the initial clone creation will look identical in both cases. The only solution would be to replace the default actions in the UI with your own and provide the differentiating logic in the action processing.

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.