item type related data in lines

If the user has selected the item type on the header, then while adding items on the line level the system must validate whether the selected item belongs to that item group. If it doesn’t belong then an error message must be displayed and the record must not be saved.
If no item type has been selected on the header, then items belonging to any item group can be selected in the to do this . give me suggestions.

Always tag your AX version.

You can have your code in validateWrite method of table or form data source depending on the need.


i am written code in datasource field itemid method lookup.but is not getting sir

You need to writing code in lookup if you are trying to build custom lookup not for validation. If you only want the validation to happen when the field is modified then write in ValidateField method.

tell me the logic sir.

Try writing on your own and let us know if you see any issues.

sir, cnd me code

sir give me reply

i am wriiten code sir,but its not working

  • its not working because you are not passing the value of itemid you are passing.
  • Replace inventtable.itemid with the itemid string control in your form and please make sure to make auto declaration property to “YES” .

If you want to filter the item id lookup based on the item group selected on the header,

Use existing method, \Data Dictionary\Tables\InventTable\Methods\lookupItemIdGroup

Call it in the lookup method and pass the item group id from header.

i dont know sir how to write the code send me sir pl urgent

Override the lookup method on form control and call the method,

InventTable::lookupItemIdGroup(_formControl, headerTable.ItemGroupId);

where i have write codse sir tell me

i got error , queries multiple level data sources not applicaple

Can you show your code?

Have you tried using this method?