Wednesday, June 27, 2018

The Product variants form can only be opened for a product master

When right-clicking > View Details on a Variant number you may receive the following message  "The Product variants form can only be opened for a product master."

Call Stack

[c]    \Data Dictionary\Tables\EcoResProductMaster\Methods\getProductMasterFromCaller   34
[c]    \Classes\EcoResProductVariantsCompanyHelper\newFromFormRun       18
[c]    \Classes\EcoResProductVariantsFormHelper\newFromFormRun             21
[c]    \Forms\EcoResProductVariantsPerCompany\Methods\productVariantsFormHelper 5
[c]    \Forms\EcoResProductVariantsPerCompany\Methods\init       3
[c]    \Classes\SysSetupFormRun\init                           5
[c]    \Classes\FormDataObject\jumpRef                                                                          
[c]    \Classes\FormStringControl\jumpRef                                                                       
[c]    \Classes\FormRun\Task                                                                                    
[c]    \Classes\SysSetupFormRun\Task                48
[c]    \Classes\FormStringControl\Context                                                                       


Problem

The method \Data Dictionary\Tables\EcoResProductMaster.getProductMasterFromCaller() handles EcoResDistinctProductVariant but not InventDimCombination.


Solution
Add the following code to \Data Dictionary\Tables\EcoResProductMaster.getProductMasterFromCaller()

    //coming from the Go to Main Table
    if (_args.lookupTable() == tableNum(InventDimCombination))
    {
        ecoResDistinctProductVariantCaller = EcoResDistinctProductVariant::find(InventDimCombination::findVariantId(_args.lookupValue()).DistinctProductVariant);
        callerRecord = EcoResProductMaster::find(ecoResDistinctProductVariantCaller.ProductMaster);
    }

No comments:

Post a Comment