procurement category hierarchy

Hi ,

i m looking for a fontion to verify if a product is exist in the procurement category hierarchy

If a procurement category is attached to the product, there is no error. else If no procurement category is attached to the product category, must display an error message by adding the category field anomalies messages.

i need your help. Thank you

you need to be more descriptive!

Hi,

This listepage Product Information Management → Common → Products → Released Product show list of product released

in the action pane product ,we have button validate ; when i select a record in the grid control and clicked in the button validate

i should verifie if the procurement category is attached to this product , there is no error ,

if no procurement category is attached to this product ,it must display an arror message

can anyone help me?

Hi,

You can do the following in the clicked method of validate button,

EcoResProductCategory resProductCat;

InventTable = InventTable::find( ‘Item id’ ); // pass the item id
resProductCat = EcoResProductCategory::findByProductIdCategoryHierarchyRole(inventTable.Product

,EcoResCategoryNamedHierarchyRole::Procurement);

if( !resproductCat)

//display the message you want

Regards,

Raghav.

Hi ,

Thank you for this solution pertinent .

i have add the code In this class **EcoResProductValidatonService ,it** is called by the button validate in th This listepage Product Information Management → Common → Products → Released Product

EcoResProductCategory               resProductCateg;
         if (TableParm::find().ProcRescatgProduct){

                InventTable = InventTable::find( 'Item id' );
                resProductCateg = EcoResProductCategory::findByProductIdCategoryHierarchyRole(inventTable.Product,EcoResCategoryNamedHierarchyRole::Procurement);
                if(resProductCateg){
                   info(strFmt(" %1   procurement category is attached to this product ",InventTable.ItemId));

                }else{
                     info(strFmt(" %1 No procurement category is attached to this product ",InventTable.ItemId));
                  }
            }

But when i test it , the variable resproductCat has always 0 like value when i user debuger , knowing that i have some product in procurement category as shown in the following screen

1134.Untitled.png

How can i fix that ?