Yes sir, I made the plugin that duplicates one selected record using ribbon button with JavaScript Web Resource,
You need the ID to the record you want to duplicate, I get it from SelectedIds property on ribbon button
First you do Xrm.WebApi.retrieveRecord, where you need to delete all the keys starting with "_yourorgname", delete the id, and format the lookups (If these steps are not clear I can explain in more detail)
After that INSIDE the then in retrieve record you call an async function which will look like this:
var duplicateAndOpen = async (recordName, data, pControl) => {
try {
var newRecord = await Xrm.WebApi.createRecord(recordName, data);
await pControl.refresh();
entityFormOptions["entityName"] = recordName;
entityFormOptions["entityId"] = newRecord.id;
Xrm.Navigation.openForm(entityFormOptions);
} catch (err) {
console.log(err);
}
};
This creates the record, saves it, and opens the edit form for the record.
Hope this helped!