Get Products
プロモーションレベルまたは戦略レベルでのプロモーション商品の管理についての詳細は、Salesforce ヘルプの「商品の管理」を参照してください。
- リソース
-
1GET_PRODUCTS - 使用可能なバージョン
- 55.0
- Apex 要求の例
-
1String salesOrg = '0001'; 2cgcloud.GetProductsCallout request = new cgcloud.GetProductsCallout(salesOrg); 3cgcloud.ProductResolutionConfiguration configuration = new cgcloud.ProductResolutionConfiguration(cgcloud.ProductResolution.ResponseFormat.DENORMALIZED /* || ProductResolution.ResponseFormat.NORMALIZED => Deprecated */); 4 5// Depending on each step we add, we will need to add some required properties to ProductResolutionConfiguration 6configuration.setSteps(new List<cgcloud.ProductResolution.ProcessStep>{ 7 // Product Source: Execute a product query with the given product filter criteria. 8 // Requires 'productfilter', 'salesorg' 9 cgcloud.ProductResolution.ProcessStep.PRODUCTQUERY, 10 //Product Source: Extract manual fixed products from the input and adds them to the result. 11 // Requires 'manualproducts' 12 cgcloud.ProductResolution.ProcessStep.MANUALPRODUCTS, 13 //Product Source: Load products for the tactic actuals defined for the tactics of the promotion defined by PromotionId. 14 // Requires 'promotionid' 15 cgcloud.ProductResolution.ProcessStep.TACTICACTUALPRODUCTS, 16 //Product Source: Load products for the payment measures defined for the tactics of the promotion defined by PromotionId. 17 // Requires 'promotionid' 18 cgcloud.ProductResolution.ProcessStep.PAYMENTPRODUCTS, 19 //Product Source: Load products for the Promotion Conditions of the promotion defined by PromotionId. 20 // Requires 'promotionid' 21 cgcloud.ProductResolution.ProcessStep.PROMOTIONCONDITIONPRODUCTS, 22 //Product Source: Load frozen products of the promotion defined by PromotionId. 23 // Requires 'promotionid' 24 cgcloud.ProductResolution.ProcessStep.FROZENPRODUCTS, 25 //Product Filter: Products those are exclude manually will be filtered out from the dynamic product resolution result. 26 // Requires 'manualproducts' 27 cgcloud.ProductResolution.ProcessStep.MANUALEXCLUDEDPRODUCTSFILTER, 28 //Product Filter: Only planning products are returned from the dynamic product resolution result. 29 // Requires 'datefrom', 'datethru', 'referencedate' (KAMStateFilter by timeframe), 30 // or 'commitdate', 'referencedate' (KAMStateFilter by commit date) 31 cgcloud.ProductResolution.ProcessStep.KAMSTATEFILTER, 32 //Product Filter: Only products that are within the global account product list of the current account are returned from the dynamic product resolution result. 33 // Requires 'accountid' 34 cgcloud.ProductResolution.ProcessStep.GLOBALACCOUNTPRODUCTLISTFILTER, 35 //Product Filter: Only products that are part of the Authorization List of the Account defined by AccountId are returned from the dynamic product resolution result. Requires 'accountid', 'datefrom', 'datethru' 36 cgcloud.ProductResolution.ProcessStep.AUTHORIZATIONLISTFILTER, 37 //Post Processing Step: Resolves the product hierarchy for the result products. 38 // Requires 'productgrouplevels', 'referenceDate' 39 cgcloud.ProductResolution.ProcessStep.RESOLVEHIERARCHY, 40 //Post Processing Step: Resolves the tactic product excludes. 41 // Requires 'tactics' 42 cgcloud.ProductResolution.ProcessStep.RESOLVETACTICPRODUCTEXCLUDES, 43 //Post Processing Step: Resolves the bill of material components 44 cgcloud.ProductResolution.ProcessStep.RESOLVEBILLOFMATERIALS 45}); 46 47configuration.setAccountId('<accountId>'); 48configuration.setPromotionId('<promotion>'); 49configuration.setReferenceDate(Date.today()); 50configuration.setCommitDate(Date.today()); 51configuration.setDateFrom(Date.today().addDays(-5)); 52configuration.setDateThru(Date.today().addDays(5)); 53configuration.setProductGroupLevels('Category'); 54configuration.setProductFilter( 55 new Map<String, Object>{ 56 'cgcloud__criterion_1_product__c' => new List<Id>{ 57 '<productid>' 58 } 59}); 60configuration.setManualProducts(new List<Id>()); 61configuration.setKAMStateFilter(cgcloud.ProductResolutionConfiguration.KAMStateFilter.bytimeframe.Name()); // OR ProductResolutionConfiguration.KAMStateFilter.bycommitdate.Name() 62configuration.addTactic('<tacticId1>', new List<Id>('<productid1>')); //List of excluded products 63configuration.addTactic('<tacticId2>', new List<Id>('<productid2>')); 64 65cgcloud.GetProductsCallout.GetProductsCalloutResponse response = request.execute( 66 cgcloud.TransactionHandler.getTransactionIdentifier(), 67 configuration 68); 69 70cgcloud.GetProductsCallout.DeNormalizedCalloutProductRows result = ((cgcloud.GetProductsCallout.GetProductDeNormalizedCalloutResponse) response).getResult(); 71System.debug(JSON.serialize(result));