您位於此處:
InsCensusService:updateMembersWithPlans
使用此服務可將主要成員、其下屬及其預先註冊的計畫填入普查。
方法:updateMembersWithPlans
運作方式
-
服務會呼叫
updateMembers以儲存成員的相關資料、剖析 JSON 物件中的成員,並為每個成員新增識別碼和isNewMember。 -
接著服務會呼叫
addPlanSelections以儲存成員的預先註冊計畫。 -
如果
isNewMember設定為 true,則addPlanSelections會刪除任何未在GroupCensusMemberPlan__c中具有項目的新建立成員,且如果onlySaveMembersWithValidProducts參數設定為 true。
遠端選項
選項 |
描述 |
|---|---|
|
必要 要上載成員所屬或將屬的普查識別碼。 用於驗證 contractId 屬於帳戶/普查。 |
|
必要 帳戶目前契約的識別碼。 用於驗證每個成員的計畫是否為契約的一部分。 |
|
布林值 如果為 true,則會刪除沒有 |
|
已串連清單
用於判斷哪些成員已存在於表格中,在此情況下會執行更新而非插入。 |
輸入 JSON
以下是輸入 JSON 的格式外觀:
{
"censusId":"a4D4P000000hbjSUAQ",
"contractId":"a4D4P000000yujQER",
"onlySaveMembersWithValidProducts":true,
"census":{
"headers":[
{
"name":"vlocity_ins__FirstName__c"
},
{
"name":"vlocity_ins__LastName__c"
},
{
"name":"vlocity_ins__IsPrimaryMember__c"
},
{
"name":"vlocity_ins__IsSpouse__c"
},
{
"name":"vlocity_ins__MemberIdentifier__c"
},
{
"name":"vlocity_ins__PrimaryMemberIdentifier__c"
},
{
"name":"Id"
},
{
"name":"vlocity_ins__ContractLineId__c"
},
{
"name":"vlocity_ins__IsOptOut__c"
},
{
"name":"vlocity_ins__OptOutTypes__c"
}
],
"members":[
{
"vlocity_ins__FirstName__c":"Maurice",
"vlocity_ins__LastName__c":"Johnson",
"vlocity_ins__IsPrimaryMember__c":true,
"vlocity_ins__IsSpouse__c":false,
"vlocity_ins__MemberIdentifier__c":"Maurice",
"vlocity_ins__PrimaryMemberIdentifier__c":null,
"vlocity_ins__ContractLineId__c":"a4D4P000000hbjSUAQ;a4D4P000000hbjSUAQ",
"vlocity_ins__IsOptOut__c" : false,
"vlocity_ins__OptOutTypes__c" :null
},
{
"vlocity_ins__FirstName__c":"Lizzy",
"vlocity_ins__LastName__c":"Johnson",
"vlocity_ins__IsPrimaryMember__c":false,
"vlocity_ins__IsSpouse__c":false,
"vlocity_ins__MemberIdentifier__c":"Lizzy",
"vlocity_ins__PrimaryMemberIdentifier__c":"Maurice",
"vlocity_ins__ContractLineId__c":"a4D4P000000hbjSUAQ",
"vlocity_ins__IsOptOut__c" :true,
"vlocity_ins__OptOutTypes__c" :null
},
{
"vlocity_ins__FirstName__c":"Jamie",
"vlocity_ins__LastName__c":"Johnson",
"vlocity_ins__IsPrimaryMember__c":false,
"vlocity_ins__IsSpouse__c":true,
"vlocity_ins__MemberIdentifier__c":"Jamie",
"vlocity_ins__PrimaryMemberIdentifier__c":"Maurice",
"vlocity_ins__ContractLineId__c":"a4D4P000000hbjSUAQ",
"vlocity_ins__IsOptOut__c" : false,
"vlocity_ins__OptOutTypes__c" :"Medical"
},
{
"vlocity_ins__FirstName__c":"Bella",
"vlocity_ins__LastName__c":"James",
"vlocity_ins__IsPrimaryMember__c":true,
"vlocity_ins__IsSpouse__c":false,
"vlocity_ins__MemberIdentifier__c":"Bella",
"vlocity_ins__PrimaryMemberIdentifier__c":null,
"vlocity_ins__ContractLineId__c":null,
"vlocity_ins__IsOptOut__c" :true,
"vlocity_ins__OptOutTypes__c" :null
}
]
},
"duplicateKeys" : [
"vlocity_ins__FirstName__c",
"vlocity_ins__LastName__c"
]
}輸出 JSON
以下是範例輸出 JSON:
{
"errors":[
{
"error":"ContractLineItem__c value is not valid:8004P000000zJKjQAM; Medical",
"vlocity_ins__FirstName__c":"Maurice",
"vlocity_ins__LastName__c":"Johnson",
"vlocity_ins__IsPrimaryMember__c":true,
"vlocity_ins__IsSpouse__c":false,
"vlocity_ins__MemberIdentifier__c":"Maurice",
"vlocity_ins__PrimaryMemberIdentifier__c":null
}
],
"censusMemberIds":[
"a4C4P000000ed6dUAA",
"a4C4P000000ed6eUAA",
"a4C4P000000ed6fUAA"
],
"memberPlanIds":[
"a4B4P000006jKsMUAU",
"a4B4P000006jKsNUAU",
"a4B4P000006jKsOUAU",
"a4B4P000006jKsPUAU"
]
}