使用進階交易詳細資料條列定價對應自訂欄位
使用者可以使用「進階詳細資料條列定價」功能,透過定價程序更新銷售交易項目或銷售交易項目詳細資料的自訂欄位。透過此功能,使用者不再需要使用自訂觸發或流程來更新這些欄位。此功能適用於修正、續約和取消使用個案。
必要版本
| 適用於:Lightning Experience |
| 適用於:已啟用交易管理的 Revenue Cloud Enterprise、Unlimited 及 Developer Edition |
| 所需的使用者權限 | |
|---|---|
| 若要設定和使用進階詳細資料條列價格: | Salesforce 管理員 與 「定價設計時間使用者」權限集 |
開始之前,請先完成這些工作。
- 若要開啟「進階詳細資料條列價格」功能,請在「設定」中尋找並選取「收入設定」,然後開啟「進階詳細資料條列價格」設定。
- 設定您的 定價程序。
- 使用 JSON 將內容標記對應新增至定價程序對應條列項目元素
若要設定定價程序以使用進階詳細資料條列定價,請將地圖條列項目 JSON 複製並貼上至「收入定價」中的定價程序。 - 使用 JSON 將內容標記對應新增至 Discovery 程序對應條列項目元素
若要設定探索程序以將進階詳細資料條列定價與衍生定價產品搭配使用,請將衍生定價 JSON 的地圖條列項目複製並貼到「收入定價」中的探索程序。
更新收入定價程序
若要設定進階詳細資料條列定價,請修改您的收入定價程序。
- 進入 App Launcher,尋找並選取「定價程序」,然後選取要更新的定價程序。
- 透過新增新的地圖條列項目元素作為定價程序中定價設定旁的第二個元素,來修改定價程序。
-
將內容標記對應新增至地圖條列項目。
輸入變數
輸出變數
LineItem
SalesTrxnItemDetailSource
LineItemQuantity
ItemDetailQuantity
NetUnitPrice
ItemDetailNetUnitPrice
price_water_fall
DetailPriceWaterfallIdentifier
InputUnitPrice
ItemDetailUnitPrice
ItemBillingReference
ItemDetailBillingReference
ItemNetTotalPrice
ItemDetailTotalPrice
TotalLineAmount
ItemDetailTotalLineAmount
EffectiveFrom
ItemDetailEffectiveFrom__std
EffectiveTo
ItemDetailEffectiveTo__std
PricingTermCount
ItemDetailPricingTermCount__std
itemTransientEndDate
ItemDetailTransientEndDate__std
ItemPricingSource
ItemDetailPricingSource__std
DerivedPricingAttribute
ItemDetailDerivedPricingAttribute__std
ItemGroupSummarySubtotal
ItemDetailGroupSummaryTotal__std
ListPrice
ItemDetailListPrice__std
IsContracted
ItemDetailIsContracted__std
ItemContractPrice
ItemDetailContractPrice__std
STI_TenantName__c
STID_TenantName__c
新增內容標記對應後,您會看見 SalesTransaction 和 SalesTransactionItemDetail 之間具有已更新內容定義的預設對應。
更新衍生的定價探索程序
如果您使用衍生的定價,請在完成對收入定價程序的變更後,對您的探索程序進行額外變更。這些變更是必要的,才能決定有效的貢獻和衍生產品。
- 進入 App Launcher,尋找並選取「探索程序」,然後選取要更新的探索程序。
-
將兩個新元素新增至探索程序至價格衍生的產品:探索設定和對應條列項目。
將這些變數新增至 Discovery 設定。
- 輸入變數:條列項目
- 輸出變數:LineItem
將這些變數新增至地圖條列項目。- 輸入變數:SalesTransactionItem
- 輸出變數:SalesTransactionItemDetail
將這些其他變數新增至地圖條列項目。
輸入變數
輸出變數
LineItem
SalesTrxnItemDetailSource
EffectiveFrom
ItemDetailEffectiveFrom__std
EffectiveTo
ItemDetailEffectiveTo__std
DerivedPricingAttribute
ItemDetailDerivedPricingAttribute__std
-
使用修正、續約和取消 (ARC) 使用個案的定價程序來支援自訂欄位。
如果您使用 ARC API 並想要使用自訂欄位,則適用自訂欄位設定。
-
修改自訂欄位的收入定價程序。
- 在定價程序中,修改 MapLineItem 元素以新增 SalesTransactionItem.CustomField 和 SalesTransactionItemDetail.CustomField 之間的對應。
-
在定價程序中建立任何必要的自訂元素,以將值指派給 SalesTransactionItem.CustomField。
定價程序會自動偵測特定條列是否有詳細資料項目,並寫入 SalesTransactionItemDetail.CustomField (若存在)。否則,會寫入至 SalesTransactionItem.CustomField。
在新銷售交易期間,會填入 SalesTransactionItem 上的 CustomField。針對含詳細資料行的 ARC 案例,詳細資料行會寫入至 SalesTransactionItemDetail 上的 CustomField。如果未針對 ARC 建立詳細資料行,則詳細資料行會寫入至 SalesTransactionItem 上的 CustomField。
- 若要在 QuoteLineItem 或 OrderProducts 上使用詳細資料行撰寫自訂欄位,請完成此涉及程序計畫和 Apex 類別的額外設定。
global class ApexCustomFieldHandler implements RevSignaling.SignalingApexProcessor {
public virtual class BaseException extends Exception {}
public class OtherException extends BaseException {}
public RevSignaling.TransactionResponse execute(RevSignaling.TransactionRequest request) {
String contextId = request.ctxInstanceId;
Context.IndustriesContext industriesContext = new Context.IndustriesContext();
// STEP 2 - Query SalesTransactionItem nodes
Map<String, Object> inputQueryItem = new Map<String, Object>{
'contextId' => contextId,
'tags' => new List<String>{ 'SalesTransactionItem', 'SalesTransactionItemDetail' }
};
Map<String, Object> itemQueryOutput = industriesContext.queryTags(inputQueryItem);
Map<String, Object> itemQueryResult = (Map<String, Object>) itemQueryOutput.get('queryResult');
List<Object> itemData = (List<Object>) itemQueryResult.get('SalesTransactionItem');
List<Object> itemDetailData = (List<Object>) itemQueryResult.get('SalesTransactionItemDetail');
Map<String, String> salesTransactionItemIdToCustomAggregatedValue = new Map<String, String>();
// STEP 3 - Custom Field Value from SalesTransactionItemDetail
for(Object itemDetailObj : itemDetailData) {
Map<String, Object> itemDetailNode = (Map<String, Object>) itemDetailObj;
Map<String, Object> detailTagMap = (Map<String, Object>) itemDetailNode.get('tagValue');
String lineItemId = (String)((Map<String, Object>) detailTagMap.get('SalesTrxnItemDetailParent')).get('tagValue');
String cfValue = (String)((Map<String, Object>) detailTagMap.get('STID_TenantName__c')).get('tagValue');
System.debug('Custom Field Value for Detail Item' + cfValue);
if(cfValue != null) {
salesTransactionItemIdToCustomAggregatedValue.put(lineItemId, cfValue);
}
}
// STEP 4 - Build update list
List<Map<String, Object>> itemNodeUpdates = new List<Map<String, Object>>();
for (Object itemObj : itemData) {
Map<String, Object> itemNode = (Map<String, Object>) itemObj;
Map<String, Object> tagMap = (Map<String, Object>) itemNode.get('tagValue');
String lineItemId = (String)((Map<String, Object>) tagMap.get('LineItem')).get('tagValue');
List<Object> dataPath = (List<Object>) itemNode.get('dataPath');
dataPath.remove(0); // Remove contextId
itemNodeUpdates.add(new Map<String, Object>{
'nodePath' => new Map<String, Object>{ 'dataPath' => dataPath },
'attributes' => new List<Object>{
new Map<String, Object>{
'attributeName' => 'STI_TenantName__c',
'attributeValue' => salesTransactionItemIdToCustomAggregatedValue.get(lineItemId)
}
}
});
}
// STEP 5 - Create collection context update
if (!itemNodeUpdates.isEmpty()) {
Map<String, Object> updateInput = new Map<String, Object>{
'contextId' => contextId,
'nodePathAndAttributes' => itemNodeUpdates
};
//Step 6 - Update context
System.debug('--- PREHOOK: SUBMITTING CONTEXT UPDATE ---');
System.debug(JSON.serializePretty(updateInput));
industriesContext.updateContextAttributes(updateInput);
}
RevSignaling.TransactionResponse response = new RevSignaling.TransactionResponse();
response.status = RevSignaling.TransactionStatus.SUCCESS;
return response;
}
}

