How to create a delivery Return with a client script with

Hi there, I have been attempting to create a delivery return based on the Sales invoice. I have successfully fetched and grouped the items based on their delivery note ID with the help of the forum. But I am stuck in how I can create a delivery return linked to their delivery note. Is there a way to do that?

ON delivery note there is check for return “is return” when we marked that check system show field for the original delivery note u can select the delibery note there and system will linked that woth the original.

But that’s on the form itself. I am trying to write a script that will create it for me. So far, my thought process is:

frappe.new_doc({
            "doctype": "Delivery Note",
            "is_return": 1,
            "return_against":sDN //sDN is the stored string of the delivery Note.  
        })

Do you think this will be enough?

just need to add item name also in refrence.