web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to Activate Item Price x++

(0) ShareShare
ReportReport
Posted on by 117

Hi all, 

       I am writing a piece of code on update button on a form where the end user can change the current price of an item by clicking on update button on Action Pane. I have written the code which can activate the updated price but the problem is every item has two sites namely USA and DRP and I want to activate it for both sites. 

On my main datasource of the form, I have a field named Site which is an enum field with two elements USA and DRP.  How can I iterate through these two elements and create two records on Item Cost form with these two sites but with updated cost. Thanks

Tell me what do you want more from me in order to understand this more. Do you need my written code ?

I have the same question (0)
  • 00030000036294D5 Profile Picture
    117 on at

                  select * from kwd_ItemCostUpdateTable;
    
                   while(kwd_ItemCostUpdateTable)
                {
                    ttsBegin;
                    itemSimTable.clear();
                        itemSimTable.ItemId = kwd_ItemCostUpdateTable.ItemId;
                        itemSimTable.Price = codeChargesTable.UpdatedPrice;
                        itemSimTable.VersionId = 'STD';
                        itemSimTable.PriceType = CostingVersionPriceType::Cost;
                        itemSimTable.PriceAllocateMarkup = NoYes::Yes;
                        itemSimTable.FromDate = today();
                        itemSimTable.Markup   =  calcCharges.getChargesValue(kwd_ItemCostUpdateTable.ItemId,  enum2str(kwd_ItemCostUpdateTable.Site));
                        itemSimTable.PriceUnit  = 1.0;
                        itemSimTable.UnitID     = 'ea';
    
    
                        inventdim.InventSiteId =    inventDim.InventSiteId;
    
                        inventDim = InventDim::findOrCreate(inventDim);
                        itemSimTable.InventDimId = inventDim.inventdimid;
                        itemSimTable.insert();
                     ttsCommit;
                }
                        inventItemPriceActivationJob = InventItemPriceActivationJob::construct();
                       inventItemPriceActivationJob.activateOneInventItemPriceSim(itemSimTable);

    This is the code I am using to activate new item price. The new records first gets inserted into InventItemPriceSim table and once we activate it with the help of InventItemPriceActivationJob class, it gets into InventItemPrice table. 

    I have tried to debug it. Here is my finding, The debugger loops through the code twice, but every time, it iterates through the same inventdimid which I do not know why. There are two Dim IDs in InventItemPrice table of the item, but it loops through the same one id both times. 

    please help !!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 659 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 533 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 289 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans