How to Update a Product and Realease to different companies.

Hi Guys,

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.…/

Also is it possible to release the product to multiple companies while while creating it.

For the update section is it the while select for update standard way or is there any other way.


Use EcoResProductReleaseManager and pass a company to releaseProductWithLegalEntityData() (or set it through parmLegalEntity()).

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).

Hi Martin ,

Thanks a lot .

I have used the following code …to test it …but its not working any idea ?

static void ReleaseProducts(Args _args)
EcoResProduct ecoResProduct;

select firstOnly ecoResProduct where EcoResProduct.DisplayProductNumber == “7042”; //Audio system

Just step into the method in debugger to see what goes wrong.

Hi Martin,

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 :slight_smile:

//Released product : this is the code I am running at run time to release a product.
// inventTable.clear();
// inventTable.initValue();
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();
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”.