위치:
InsProductJSONService:updateUserValues
이 서비스를 사용하여 사용자가 변경한 사항을 기반으로 제품 JSON에서 지정된 속성의 userValues를 업데이트합니다. 이 서비스를 사용하여 JSON 노드가 계층에 있는 위치를 업데이트할 수도 있습니다.
방법: updateUserValues
작동 방법
-
inputKey및attributeValues을 사용하여 업데이트할 특성이 있는 입력 JSON의 노드를 찾습니다. -
productCode및/또는attributeCode가 설정된 경우 서비스가 일치시킬 JSON을 필터링합니다. -
validate = true인 경우 가능한 특성 값을 기준으로 새 특성 값을 확인합니다. -
업데이트된 특성과 함께 제품 JSON을 반환합니다.
원격 옵션
옵션 |
설명 |
|---|---|
|
이 서비스에서 작업할 제품 JSON의 일부를 찾는 데 사용하는 키입니다. 기본값은 |
|
이 |
|
이 |
|
True/False 특성을 찾기 위해 atttributeCode에 지정된 부분 값을 사용하여 작업합니다. 기본값 = |
|
이 |
|
True/False 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
서비스는 result 키 아래의 새 속성 값과 원래 속성 값에 대한 정보가 포함된 업데이트된 제품 JSON을 반환합니다.
다음 예에서 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
}
