
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 ?
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 !!