xTuple.com xTupleU Blog & News Customer Support


Since we custome many of the standard xTuple screens, such as crmacct, vendor, etc. I add custom screen to the tab list of the screen.

Basically, I pass the id of the screen to my custom script to fill the custom screen, using mywidget.id() function.

This works in crmacct, vendor,sales order, invoices, ect.

But when I try to do the same in the Contract screen, the debugger throws an error; and upon inspection of the mywidget variable. I find NO id() function.

Is there a way to get the contract id from the contratc screen?

mywindow.id() only works for some screens which are specifically coded to support that logic.

Typically the id is sent to the screen when opening so can be picked up in the set() function which always runs so you can script something like:

var _contractid;
function set(input) {
   _contractid = input.contrct_id;

The problem lies for new contracts where the id has not yet been determined (it is actually determined in the core set() function not available to script). You need some funky logic to get the CURRVAL() sequence id - not impossible but not pretty logic, which is why the idea of emitting the window ID() is far superior.

Thank you Anderson, that work

But I do believe that consistency across classes would be beneficial. After all the contract class includes
the xwidget class.