xTuple.com xTupleU Blog & News Customer Support

Trying to Open Sales Order Line Screen from script

Hello,

I'm trying to open the salesOrderItem screen using the following code:

function SOLineOpen(mode, number)

{

    try

    {

 

         var qry = toolbox.executeQuery(" SELECT cohead_number, cohead_curr_id, cohead_orderdate, cohead_cust_id "

                                                           +" FROM cohead LEFT OUTER JOIN coitem ON (coitem_cohead_id=cohead_id) "

                                                           +" WHERE coitem_id = " + number + ";")

        if(qry.first())

        {

                  var params = new Object;

                  params.mode = mode;

                  params.soitem_id = number;

                  params.cust_id = qry.value("cohead_cust_id");

                  params.curr_id = qry.value("cohead_curr_id");

                  params.orderDate = qry.value("cohead_orderdate");

        }

        var childwnd = toolbox.openWindow("salesOrderItem",mywindow);

        var tmp = toolbox.lastWindow().set(params);

 

     }

     catch(e)

     {

          print(e);

          QMessageBox.critical(mywindow, "Database Error", "Critical error:" + e);

     }

}{C}

 

I'm passing all those parameters since I saw that from returnAuthorization.cpp does the same. I'm not getting any error but the screen is not showing up. Can somebody point me in the right direction?

 

Thanks,

Javier

Try this:

var childwnd = toolbox.openWindow("salesOrderItem", mywindow);

toolbox.lastWindow().set(params);

childwnd.show();

 


        

Thank you David!