Get Data From Custom Doctype and Bring it into a Child Table of Other Doctype

I need help with a custom script (client-side) that would get data from a custom doctype and bring it into the child table of the select doctype.

Basically, I want to introduce a button on Sales Order Doctype (like the Get Items From button or similar) which will bring data from the child table of a custom Doctype.

I was able to partially achieve this with the help from this script shared by @ lasalesi

frappe.ui.form.on('Test Certificate', {
    refresh: function(frm) {
        frm.add_custom_button(__("Get items from sales invoice"), function() {

function show_sinv_dialog(frm) {
      {'fieldname': 'sales_invoice', 'fieldtype': 'Link', 'label': 'Sales Invoice', 'reqd': 1, 'options': 'Sales Invoice'}  
   'Get items from sales invoice',
   'Get items'

function get_items_from_sinv(sales_invoice) {{
    "method": "frappe.client.get",
    "args": {
        "doctype": "Sales Invoice",
        "name": sales_invoice
    "callback": function(response) {
         // add items to your child table
         var sinv = response.message;
         sinv.items.forEach(function (item) {
             var child = cur_frm.add_child('items');
             frappe.model.set_value(child.doctype,, 'item_code', item.item_code);
             frappe.model.set_value(child.doctype,, 'qty', item.qty);

But I want a dialog similar to the image below. So when I press the custom button this dialog should help me filter based on the selected customer and help me bring data in the custom child table I’ve already created in the Sales Order Doctype.

Any help would be immensely appreciated.