I am working on Form # 30 - Item Card and the defaults that show up when entering a new part. Some of the defaults that show up when you enter a new part we want changed to another value.
Gen. Prod. Posting Group is one of them.
I have checked the table design, form property, form field propery, the CAL-Code and I see nothing that is pushing these values into the form. I have checked for Codeunits and their not pushing anything into these fields.
Open the customer card, turn on the debugger, and hit F3. Step through the code to see if you can find where C/AL code changes that value. Then when you get control back to the customer card, hit enter (inserting the record) and step through that process. It comes from somewhere, you just need to figure out where.
When I enter a new part and put something in the Item Category Code than it bangs in the Gen. Prod. Posting Group. I think it has to do with table 5722.
Thanks for pointing me in the right direction. I’ll have to play with the debugger.
Ah now you’re making more sense (plus I got the sand out of my eyes and realized you were talking about Items not Customers). The Gen Prod Posting group defaults from the Item category, and the code that does this is in the OnValidate of the Item Category code in the Item table. Open the item table in the table designer, find the Item Category field and hit F9.
Note where it says this:
IF “Gen. Prod. Posting Group” = ‘’ THEN
VALIDATE(“Gen. Prod. Posting Group”,ItemCategory.“Def. Gen. Prod. Posting Group”);
If you set the posting group before setting the item category code, it should leave the original value alone. It only sets it when the PG is blank.