Active price upload from excel

But we don’t want to do the update like this, kranthi.

When we activate a new item in pending price, prices getting updated manually in item master form…

Like that when we upload a new items in active price form it needs to update the price manually in itemmaster form like how its updating from pendingprice> activate button…

How should we do that, Kranthi?

That will happen, in case if you are creating a pending price and activating it. Have a look at \Classes\InventPriceActivationModule\activate

In your case, you are directly creating the price. So you may have to update it with the code.

If i do update through coding, does it affect any background process or it is a best practice to do that?

If I upload my items to pending price and is there any possibility to activate all the items?

You can activate all the prices from that costing version. Inventory management → Periodic → Bill of materials → Costing versions

 if(row > 1)
        {
            select firstonly iips where iips.ItemId==_itemid && iips.VersionId==_versionid;
            iips.ItemId=_itemid;
            iips.VersionId=_versionid;
            iips.PriceType=CostingVersionPriceType::Sales;
            _inventdim.InventSiteId=_site;
            iips.InventDimId=InventDim::findOrCreate(_inventdim).inventDimId;
            iips.Price=_price;
            iips.FromDate=systemdateget();
            iips.insert();
            _type=iips.PriceType;
            _fromdate=iips.FromDate;
            _invent=iips.InventDimId;
            try
            {
                ttsbegin;
                inventItemPriceSimulated = InventItemPriceSim::find(_itemid,
                                                         _versionid,
                                                         _fromDate,
                                                         _type,
                                                         _invent,
                                                         '',
                                                         true);
                inventItemPriceSimulated.moveSimulatedToCurrent();
                inventTableModule = InventTableModule::find(_itemid,
                                                        InventItemPrice::convPriceTypeToModuleInventPurchSales(_type),
                                                        true);
                inventTableModule.initFromInventItemPriceSim(inventItemPriceSimulated);
                inventTableModule.update(false);
                ttscommit;
           }
            catch (Exception::UpdateConflict)
            {
            if (appl.ttsLevel() == 0)
            {
            if (xSession::currentRetryCount() >= #RetryNum)
            {
                throw Exception::UpdateConflictNotRecovered;
            }
            else
            {
                retry;
            }
        }
        else
        {
            throw Exception::UpdateConflict;
        }
    }
            info(strfmt("Items inserted successfully for %1",iips.ItemId));

        }

is it looking fine, kranthi?

iips is Inventitempricesim

is it possible to do through x++ while we import from excel into pending price?

Yes, look at the class that is used for activating the prices and call it.

InventItemPriceActivationJob extends runbasebatch, kranthi…

Shall I call this method after insert or shall i call InventPriceActivationModule activate method?

InventItemPriceActivationJob::activateInventItemPriceSimExt(iips);

This is the method activating the price and updating in item master form

Please for such kind of doubts you can create a New Thread.

I don’t have AX 2009 to check.I have AX 2012 and i don’t see that method.

If you think that method activates the price, then you can use it.

Sorry i missed it. I can see that method even in AX 2012. You can use that method.

Yes, its updating the price, when we use that method Kranthi.

I’ve one more doubt in inventtable I’ve an refitemid field, tat field is for in our portal all our items will be referred as 100.100 but in our item form items will be referred as FM-100-100

So if my excel is having record like 100.100 its need to be inserted and update the price in FM-100-100…

How could i refer that here?