Have you tried in salesline?

Hi,

Have any body tried to print the Serial Number from Sales Line table by writing a job?

actually when we check the salesline form there are many datasources in that be 3 main datasource are sales table,sales line and inventDim.

i can pick the itemid from sales line w.r.t sales.salesId but there is problem in displaying Serial Number from InventDim datasource.

The code is

SalesTable SalesTable;

SalesLine SalesLine;

InventDim InventDim;

select SaleTable where SalesTable.SalesId == ‘000022’;

while select ItemId, inventDimId from SalesLine where SalesLine.SalesId == SalesTable.SalesId // ie ‘000022’

{

// now we select the serial number (ie inventSerialId field of InventDim Table)

select inventSerialId from InventDim where InventDim.inventDimId == SalesLine.InventDimId;

print SalesLine.ItemId;

print InventDim.inventSerialId; // but its displaying wrong serial no. which is not same as the serial number in the Form

Pause;

}

how to print correct serial no. ?? can any body help me

you can find the salesLine related inventDim by using salesLine.inventDim().inventSerialId;/// any dimension

Hi Kranthi,

salesLine.inventDim().inventSerialId; also printing the same wrong result the same as the statement

while select ItemId, inventDimId from SalesLine where SalesLine.SalesId == SalesTable.SalesId // ie ‘000022’

{

// now we select the serial number (ie inventSerialId field of InventDim Table)

select inventSerialId from InventDim where InventDim.inventDimId == SalesLine.InventDimId;

print SalesLine.ItemId;

print InventDim.inventSerialId; // but its displaying wrong serial no. which is not same as the serial number in the Form

print salesLine.inventDim().inventSerialId;// YOUR CODE

Pause;

}

Is there any other method to get the correct InventSerialID

SalesLine need not be having dimId with all the dimsension(as it will prompt you only for mandatory dimensions and the dimensions are changeable during the posting process), so its better to fetch the inventDimId from inventTrans, the inventTrans and salesLine are related through inventTransId(considering the case in AX 2009, as in AX 2012 the inventTrans has been refactored) and one salesLine may have multiple split lots(transactions with same inventTransId) in InventTrans

Hi Kranthi,

There is a in built method in InventDim::find(SalesLine.InventDimId,false); which gives me the correct serial no. Thanks again f

static void JobGetSerialNo(Args _args)
{
//8075814
SalesTable SalesTable;
SalesLine SalesLine;
//WMSOrderTrans WMSOrderTrans;
InventDim InventDim;
InventTrans InventTrans;
;

select SalesTable where SalesTable.ReturnItemNum == ‘RMA29102’;
while select SalesLine where SalesLine.SalesId == SalesTable.SalesId
{
/select InventDim where SalesLine.InventDimId == InventDim.InventDimId;
print InventDim.inventSerialId;
print salesLine.inventDim().inventSerialId;
print SalesLine.ItemId;
pause;
/

//select InventTrans Where InventTrans.inventDimId == SalesLine.InventDimId;

inventDim = InventDim::find(SalesLine.InventDimId,false);
print InventDim.inventSerialId;
pause;

}
}

salesLine.inventDim() will do the same job

But I got wrong serial no. printed where as in the ReturnOrder form the serial no. is differently shown(the actual serial no.)

By debugging you will be able to find the difference