The default behavior of Duplicate action is to execute the New action and automatically copy values from the current row into the fields of the record. If it is necessary to change the default behavior, a custom business rule must be used.
A user can duplicate a customer using the Duplicate context menu option in Customers grid.
The create form will be opened. Fields will be populated using the values of the original record.
Let’s add a business rule that will add an asterisk (*) to the Customer# field.
Start the Project Designer. In the Project Explorer, switch to the Controllers tab. Right-click on Customers / Business Rules node, and press New Business Rule.
Assign these values:
|Property ||Value |
|Command Name ||New |
|Phase ||After |
[CustomerID] = [CustomerID] + '*';
Press OK to save. On the toolbar, press Browse.
Navigate to the Customers page. Activate the context menu for a row and press Duplicate.
The Customer# value will be appended with an asterisk.
This Duplicate action is only client-side. The data is only saved to the server when the user presses OK.
More complex duplication calculations that require database interaction can be implemented with the use of REST (Representational State Transfer) or with the use of SQL Business Rules.