Generate LotId or inventTransid by code in MSD axapta

Some times we need to generate lot Id by code in axapta 4.0 or 2009. following are code you can set in your program too.


 NumberSeq      _numberSeq;   
 salesline salesline;  
 ;  
 _numberSeq=NumberSeq::newGetNumFromCode(NumberSequenceReference::find(TypeId2ExtendedTypeId(typeid(InventTransId))).NumberSequence);  
 salesline.InventTransId=_numberSeq.num();  

Just you need to pass Extended data type InventTransId to given function I hope this method or code will help you.