Can someone let me know if there is any standard code to update a product .I know the code to create a new product and release it as per the below link.
Regarding updating a product, what do you need except the usual record update (MSDN - How to: Update Data)?
Use while select if you have a bunch of records to update in a loop. If you have just a single record, you don’t need any while loop, therefore use select alone (possibly with firstOnly).
I have found the solution for that …but this code doesn’t work as I intnded to …
I am creating a Product /Product Master and releasing (see below code)…this gets released in the current company only.
However if I use the Release Class it just releases to the company and does not takes into consideration the itemgroupid and itemmodelgroupid and so on …
Shall I rerun the Release code(below one) for each company ? If yes then how shall i achieve that ?
Thanks for your inputs
//Released product : this is the code I am running at run time to release a product.
// inventTable.clear();
// inventTable.initValue();
inventTable.initFromEcoResProduct(ecoResProductMaster);
select forupdate RecId from inventTable where inventTable.ItemId == ecoResProductDisplayProductNumber;
{
inventTable.NameAlias = ecoResProductSearchName;
// if (inventTable.validateWrite())
// {
// inventTable.update();
}
//Inventory model group
// inventModelGroupItem.clear();
// inventModelGroupItem.initValue();
select forUpdate RecId from inventModelGroupItem where inventModelGroupItem.ItemId == inventTable.ItemId;
{
inventModelGroupItem.ItemDataAreaId = inventTable.dataAreaId; //inventModelGroupItem.ItemId = inventTable.ItemId;
inventModelGroupItem.ModelGroupId = “FIFO”;
inventModelGroupItem.ModelGroupDataAreaId = curext();
// inventModelGroupItem.update();
}
//Item group
// inventItemGroupItem.clear(); //inventItemGroupItem.initValue();
select forUpdate RecId from inventItemGroupItem where inventItemGroupItem.ItemId == inventTable.ItemId;
{
inventItemGroupItem.ItemDataAreaId = inventTable.dataAreaId; //inventItemGroupItem.ItemId = inventTable.ItemId;
inventItemGroupItem.ItemGroupId = “Parts”;
inventItemGroupItem.ItemGroupDataAreaId = curext();
// inventItemGroupItem.update();
}
EcoResProductReleaseSessionManager is what standard AX uses for releasing product to companies. You’re free to implement something else if you really want, but you explicitly asked for “any standard code”.