Adding a field to a copy button that modifies the copied fields


I have a custom module that contains a large number of currency fields. The requirement is to use a copy button in the record view to still create a copy of the record but applying a multiplier percentage to all currency fields.

The multiplier has to be chosen at the time of copying - and there is not the option to use a field in the record that can pass the value through (editing the old record will fire a number of logic hooks and custom scheduled jobs that should not be started).

I thought one way to go would be to create a custom record layout for the module that just contains a field for the multiplier and a button to copy - which will route between the record view and the copy creation - but I was wondering if anyone can think of a more simple way of doing this?



  • I can imagine 1 option:

    To create a floating div which renders when hitting button copy. This div has the multiplier percentage. After saving that percentage the create view is rendered properly and target currency fields updated accordingly. You need to create a custom view for the floating div, override action of copy button and extend the js controller for create view in order to calculate target currency fields.

    André Lopes
    Lampada Global
    Skype: andre.lampada