Olet tässä:
InsProductJSONService:updateUserValues
Käytä tätä palvelua päivittääksesi tuotteen JSON-tiedoston määritettyjen attribuuttien userValues käyttäjän tekemien muutosten perusteella. Voit käyttää tätä palvelua myös päivittääksesi hierarkiassa olevan JSON-noodin.
Metodi: updateUserValues
Miten se toimii?
-
Käyttää
inputKeyjaattributeValueslöytääkseen noodin syötetyssä JSON-tiedostossa, jossa on päivitettävät attribuutit. -
Jos
productCodeja/taiattributeCodeon määritetty, palvelu suodattaa JSON-tiedoston täsmäämään. -
Vahvistaa uuden attribuutin arvon mahdollisten attribuutin arvojen perusteella, jos
validate = true. -
Palauttaa tuotteen JSON-tiedoston päivitetyillä attribuuteilla.
Etäasetukset
Vaihtoehto |
Kuvaus |
|---|---|
|
Avain, jota tämä palvelu käyttää löytääkseen työstettävän JSON-koodin osan. Oletusarvo on |
|
Löytää tähän |
|
Löytää tämän |
|
Tosi/epätosi Toimii osittaisen arvon kanssa, joka on määritetty attributeCode-kenttään attribuutin hakemiseksi. Oletus = |
|
Löytää tämän |
|
Tosi/epätosi Vahvistaa uudet attribuutin arvot kaikkien määritetyn attribuutin sallittujen arvojen perusteella ennen JSON-tiedoston päivittämistä. Oletus = |
Syötetty JSON
Tämä palvelu ottaa tyypillisen tuotteen JSON-tiedoston, jonka se tunnistaa käyttämällä inputKey- ja attributeValues-arvoja attributeCode- ja uuden userValues-arvojen kartan muodossa.
Lisätietoja tuotteiden JSON-tiedostojen rakenteesta on kohdassa Product JSON Structure Model.
Alla olevassa esimerkissä liveCoverageAmt-attribuuttien arvo on 250 000 dollaria. Ja "attributeValues"-kentässä sen arvoksi muutetaan 500 000 dollaria.
{
"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"
}
}
Tulos-JSON
Palvelu palauttaa päivitetyn tuotteen JSON-tiedoston, joka sisältää uudet result-avaimen alla olevat attribuutin arvot ja alkuperäisen attribuutin arvon tiedot.
Seuraavassa esimerkissä liveCoverageAmt-attribuutin arvo muutettiin 250 000 dollarista 500 000 dollariin.
{
"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
}
