Announcements
Every time we create a new item under "Product Information Management", the field "Latest Purchase Price" is set by default to NO and I need to always manually change it to YES in order to capture the latest purchase price when we create a PO.
The question here is how can this field be set to "YES" by default so that any items that will be created in the future will automatically have the field set to YES.
Create a record template.
HI Bader814,
Add these codes to your class
[ExtensionOf(tableStr(InventTable))]
final class InventTableMy_Extension
{
public void myDefaultPurchModel()
{
// This would have partner specific logic to initialize the new field.
this.PurchModel = NoYes::Yes;
}
}
class InventTableMy_EventHandler
{
[DataEventHandler(tableStr(InventTable), DataEventType::Inserting)]
public static void InventTable_onInserting(Common sender, DataEventArgs e)
{
InventTable inventTable = sender as InventTable;
// Call the method as if it was defined directly on InventTable.
inventTable.myDefaultPurchModel();
}
}
The result like this:
Best Regards
Tom Cai
Hi Bader814,
I dont think that it is possible without a customization, but it should be a minor change to make it ticked by default.
André Arnaud de Cal...
293,304
Super User 2025 Season 1
Martin Dráb
232,149
Most Valuable Professional
nmaenpaa
101,156
Moderator