How to get data from a form in a class?

Hi everyone,

I use Ax 2012 R3,

 -->Accounts receivable/Common/Sales orders/All sales orders

  --> Select one sales order and double click (open it) and will show this form


 I make this class:

when I open form from first photo and then click on SalesOrder Query in toolbar - left. It execute my class and open this form

I want , when execute it in field InventTransId automatically to fill with current SO as shown in the first picture.

Give me some ideas.
Thank you.