Duplicate/Clone a single record from custom listview

Hello, I’m working with a custom list view on SuiteCRM 7. The thing is that I want the same thing that duplicate button on actions in the DetailView does, but, I want it in my custom button that I created on the Listview. I have already did this procedure with edit action because it redirects to a URL index.php?module=module&action=EditView&record={id}, so I just needed to make an OnClick and href. But for some reason specifically when duplicating a record the URL is hidden, any ideas of how can I achieve what I want? I dont want just duplicate the record because I already know how to do it with Beans, the thing is that I want to redirect to the editview with the autofill the same way that SuiteCRM duplicate action does, any ideas or function?

Hi @gabcadi,
to duplicate a record in SuiteCRM 7 using the same functionality as the built-in Duplicate button, you can use the CopyRecord action with a URL similar to the following:

index.php?action=CopyRecord&module=Accounts&record=1234

Here, Accounts is the module name and 1234 is the ID of the record to duplicate.

You can create a custom button on the List View and use the window.location.href method to redirect to the URL with the appropriate parameters. Here’s an example code snippet:

phpCopy code

<button onclick="duplicateRecord(1234)">Duplicate Record</button>

<script>
function duplicateRecord(recordId) {
  window.location.href = 'index.php?action=CopyRecord&module=Accounts&record=' + recordId;
}
</script>

Replace Accounts with the name of the module you want to duplicate records for, and 1234 with the ID of the record you want to duplicate.