您在此处:
InsProductJSONService:updateUserValues
使用此服务根据用户所做的更改更新产品 JSON 中指定属性的userValues。您也可以使用此服务更新 JSON 节点在层次结构中的位置。
方法:updateUserValues
工作原理
-
使用
inputKey和attributeValues在输入 JSON 中查找具有要更新的属性的节点。 -
如果设置了
productCode和/或attributeCode,服务会筛选匹配的 JSON。 -
如果
validate = true,根据可能的属性值验证新属性值。 -
返回具有更新属性的产品 JSON。
远程选项
选项 |
说明 |
|---|---|
|
此服务用于查找要使用的产品 JSON 部分的密钥。 默认值是 |
|
查找与此 |
|
查找此 |
|
真/假 使用为 atttributeCode 指定的部分值来查找属性。 默认 = |
|
查找与具有此 |
|
真/假 在更新 JSON 之前,根据给定属性的所有允许值验证新属性值。 默认 = |
输入 JSON
此服务以attributeCode和新userValues的地图形式使用inputKey和attributeValues识别的典型产品 JSON。
要了解如何构建产品 JSON,请参阅产品 JSON 结构模型。
从以下示例中,liveCoverageAmt 的属性值为 250,000 美元。在“attributeValues”中,将更改为 $500,000。
{
"inputKey": {
"totalSize": 1,
"records": [
{
"Name": "Product1",
"ProductCode": "Product1",
"attributeCategories": {
"totalSize": 1,
"records": [
{
"displaySequence": 449,
"id": "a0O6A000001XFIPUA4",
"Name": "Life Terms",
"Code__c": "LIFETERMS",
"productAttributes": {
"totalSize": 1,
"records": [
{
"code": "lifeCoverageAmt",
"dataType": "text",
"inputType": "dropdown",
"multiselect": false,
"required": false,
"readonly": false,
"disabled": false,
"filterable": true,
"attributeId": "a0P6A0000032HllUAE",
"label": "Coverage Amount",
"displaySequence": 1,
"hasRules": false,
"hidden": false,
"values": [
{
"id": "0",
"label": "$250,000",
"readonly": false,
"disabled": false,
"value": "250000"
},
{
"id": "1",
"label": "$500,000",
"readonly": false,
"disabled": false,
"value": "500000"
},
{
"id": "2",
"label": "$1,000,000",
"readonly": false,
"disabled": false,
"value": "1000000"
}
],
"userValues": "250000",
"parentProductId": "a2mf4000000kYR7AAM",
"parentProductCode": "InsLife",
"originalAttributeIndex": 0,
"originalCategoryIndex": 1,
"originalProductIndex": 1,
"pathFromChild": "attributeCategories.records[1].productAttributes.records[0]",
"pathFromRoot": "\"pathFromRoot\": \"childProducts.records[1].attributeCategories.records[1].productAttributes.records[0]\""
}
]
}
}
]
}
}
]
},
"attributeValues": {
"lifeCoverageAmt": "500000"
}
}
输出 JSON
该服务返回更新后的产品 JSON,其中包含result键下的新属性值和原始属性值的相关信息。
在以下示例中,liveCoverageAmt 属性的值从 $250,000 更改为 $500,000。
{
"records": [
{
"attributeCategories": {
"records": [
{
"productAttributes": {
"records": [
{
"pathFromRoot": "\"pathFromRoot\": \"childProducts.records[1].attributeCategories.records[1].productAttributes.records[0]\"",
"pathFromChild": "attributeCategories.records[1].productAttributes.records[0]",
"originalProductIndex": 1,
"originalCategoryIndex": 1,
"originalAttributeIndex": 0,
"parentProductCode": "InsLife",
"parentProductId": "a2mf4000000kYR7AAM",
"userValues": "500000",
"values": [
{
"value": "250000",
"disabled": false,
"readonly": false,
"label": "$250,000",
"id": "0"
},
{
"value": "500000",
"disabled": false,
"readonly": false,
"label": "$500,000",
"id": "1"
},
{
"value": "1000000",
"disabled": false,
"readonly": false,
"label": "$1,000,000",
"id": "2"
}
],
"hidden": false,
"hasRules": false,
"displaySequence": 1,
"label": "Coverage Amount",
"attributeId": "a0P6A0000032HllUAE",
"filterable": true,
"disabled": false,
"readonly": false,
"required": false,
"multiselect": false,
"inputType": "dropdown",
"dataType": "text",
"code": "lifeCoverageAmt"
}
],
"totalSize": 1
},
"Code__c": "LIFETERMS",
"Name": "Life Terms",
"id": "a0O6A000001XFIPUA4",
"displaySequence": 449
}
],
"totalSize": 1
},
"ProductCode": "Product1",
"Name": "Product1",
"displaySequence": -1
}
],
"totalSize": 1
}
