Adding Production time to a field on Sales order line (ax2009)

I have created a date field (Planned date) on Sales order line . When a item is added to line, auto-populate the Planned date field such that the Production time should be added into it with sys date as

Planned date = sys date + Item coverage Production time.

How to achieve this as both are different forms ? ( i added the code in modified field of sales order line ) but it was not functional at all.

From where does this comes Or where it is stored?

Planned date is a date field just below the delivery date(modified as Requested date) in sales order form

No i am asking for item coverage production time.

InventTable>Setup>ItemCoverage>LeadTime(Tab)>Production>ProductionTime

Ok, that is from ReqItemTable. You need to find that with the help of Item Id and covInventDimId (InventDImid built with coverage dimensions). Look at the find method in ReqItemTable and its cross references to know how to built the covInventDimId.

Will this functionality be achieved by Init() method on DataSource and using Args ()

No. the modification of itemId should handle this. ModifiedField on table or Modified on Form data source field (depending on the need)

ok i am too much confused i have tried code in both and also put debugger but it is not even debugging it , guide me how can i display current date in my customized field(planned date).

If i am able to insert system date into it i will manage to add production days in it as well

That should be working, unless the sales line is created from the another source or you are not manually modifying the item id on sales Lines. Will you be able to show/tell us what logic and where you have written?

On modified field in SalesLine i wrote

case fieldnum(SalesLine, PlnDate):

if(this.ItemId)

{

this.PlnDate = d;

}

break;

(where d = today())

and in Forms>Salestable>SalesLine>PlnDate>modified

public void modified()

{

super();

if(salesline.ItemId)

{

salesline.smylHexPlnDate = today();

}

}

where d = today()

You want the plan date to be populated when the item id is updated, so the code should be triggered when the item id is modified but not on its own modified event

I have tried that as well Kranthi and i don’t think it is working out at all

Are you not getting the value OR if you are getting a value and it is not correct?

No value

i am not getting any value at all Kranthi , i think i am lost

The following code has been added in SalesLineType class >InitFromInventTable

salesline.PlnDate = systemdateget() + reqItemTable::find(SalesLine.ItemId,SalesLine.InventDimId).LeadTimeProduction;

and it works

Remember that the reqItemTable find needs a covInventDimId, it only works as long as the sales inventDimId and covInventDimId are same. If your sales line have dimension more or less than the coverage dimensions, then it may not work.

You can use, \Data Dictionary\Tables\InventDim\Methods\reqCovDimId for getting covInventDimId for an inventDimId (the method is from AX 2012, i am not sure if it exists in AX 2009)