Thursday, May 5, 2016

How to get a field directly from args when opening a form.

The standard code I used to get a field from args was

InventTrans inventTrans = element.args().record() as InventTrans;

info(int642str( inventTrans.recID));

Recently found a way to just use

info(int642str(element.args().record().(fieldNum(InventTrans, RecId)))); 

which save all the work of type casting and does it all in one line.

Tuesday, May 3, 2016

Time Consumed method


If you want to get the total time consumed by a method, you can use the timeConsumed method in the following way which works great to show how long a method took to run.


FromTime startTime = timeNow();
//blahblah.doiT()
    info(strFmt("Total time consumed is  %1", timeConsumed(startTime, timeNow())));