Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Latest Purchase Price ...
Finance forum

Latest Purchase Price - How to make it by default to YES for all items that will be created in the future

(0) ShareShare
ReportReport
Posted on by

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.  

8420.1.JPG

Categories:
  • Adis Profile Picture
    3,127 Super User 2025 Season 1 on at
    Latest Purchase Price - How to make it by default to YES for all items that will be created in the future
    Hey,
     
    You could also check if it is possible to change the switch via Power Automate. Its always recommened not to interfere with the code. As soon as something doesnt work, you wont get supoort with custom code.
    Worst thing might need to be changed is the entity and\or the creation of a business event, in case you want to enable the switch in a specific event. Might be even more developer work than changing the default setting, but you have no custom code.
     
    Kind regards, Adis
  • Suggested answer
    Elodie Baudin Profile Picture
    135 on at
    Latest Purchase Price - How to make it by default to YES for all items that will be created in the future
    Hello, 
    You need to create an item template to solve your problem, do you know how you make make this? 
    Do you use Released Products or only products? 
     
    Otherwise, you have to use Data management to change this option , but it will be after the item creation so this could be risky if transactions are made in the meantime.

    I hope this comment answer to your request ;) 
  • guk1964 Profile Picture
    10,877 on at
    RE: Latest Purchase Price - How to make it by default to YES for all items that will be created in the future

    Create a record template.

    docs.microsoft.com/.../record-template

  • Community Member Profile Picture
    on at
    RE: Latest Purchase Price - How to make it by default to YES for all items that will be created in the future

    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:

    _5563B783_16.PNG

    Best Regards

    Tom Cai

  • Mea_ Profile Picture
    60,278 on at
    RE: Latest Purchase Price - How to make it by default to YES for all items that will be created in the future

    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. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,304 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans