Create a Sales Order via Related List Button

Create a Sales Order via Related List Button

Currently within the Deals module we have a button associated with the Products related list for creating a Quote. I am attempting to add a second button to create a Sales Order by modifying the custom function for the Quote button. The button opens the Sales Order module however, nothing populates the page and the ZOHO CRM in the of the page appears to loading. I am adding the Quote script that is working perfectly and the modified script. Can someone point out my issues? Thanks in advance.

Quote Button Script

potDetails = zoho.crm.getRecordById("Deals",potIdStr.toLong());
proreqIdsList = proreqId.toList("|||");
product_items = List();
for each  productId in proreqIdsList
{
    relcust = zoho.crm.getRecordById("Products",productId.toLong());
    productDesc = ifnull(relcust.get("Description"),"Manque Description Produit !!!");
    lineitem = Map();
    lineitem.put("product",{"name":relcust.get("Product_Name"),"id":relcust.get("id").toLong()});
    lineitem.put("product_description",productDesc);
    lineitem.put("quantity",1);
    lineitem.put("list_price",ifnull(relcust.get("Unit_Price"),"0.0").toDecimal());
    product_items.add(lineitem);
}
paramap = Map();
paramap.put("Product_Details",product_items);
paramap.put("Subject",ifnull(potDetails.get("Deal_Name"),""));
paramap.put("Contact_Name",ifnull(potDetails.get("Contact_Name").get("id"),""));
paramap.put("Account_Name",ifnull(potDetails.get("Account_Name").get("id"),""));
paramap.put("Deal_Name",potIdStr.toLong());
paramap.put("Description",ifnull(potDetails.get("Description"),""));
createResp = zoho.crm.createRecord("Quotes",paramap);
info createResp;
newid = createResp.get("id");
openUrl("https://crm.zoho.com/crm/org648779890/tab/Quotes/" + newid,"same window");
return "Success! Refresh the page to populate new quote in the list below.";

Modified Sales Orders Script

potDetails = zoho.crm.getRecordById("Deals",potIdStr.toLong());
proreqIdsList = proreqId.toList("|||");
product_items = List();
for each  productId in proreqIdsList
{
    relcust = zoho.crm.getRecordById("Products",productId.toLong());
    productDesc = ifnull(relcust.get("Description"),"Manque Description Produit !!!");
    lineitem = Map();
    lineitem.put("product",{"name":relcust.get("Product_Name"),"id":relcust.get("id").toLong()});
    lineitem.put("product_description",productDesc);
    lineitem.put("quantity",1);
    lineitem.put("list_price",ifnull(relcust.get("Unit_Price"),"0.0").toDecimal());
    product_items.add(lineitem);
}
paramap = Map();
paramap.put("Product_Details",product_items);
paramap.put("Subject",ifnull(potDetails.get("Deal_Name"),""));
paramap.put("Contact_Name",ifnull(potDetails.get("Contact_Name").get("id"),""));
paramap.put("Account_Name",ifnull(potDetails.get("Account_Name").get("id"),""));
paramap.put("Deal_Name",potIdStr.toLong());
paramap.put("Description",ifnull(potDetails.get("Description"),""));
createResp = zoho.crm.createRecord("SalesOrders",paramap);
info createResp;
newid = createResp.get("id");
openUrl("https://crm.zoho.com/crm/org648779890/tab/SalesOrders/" + newid,"same window");
return "Success! Refresh the page to populate new quote in the list below.";