Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
endorseDraftInsurancePolicy(insurancePolicyDraftProcessInput, policyId)
API Version
67.0
Requires Chatter
No
Signature
public static ConnectApi.InsurancePolicyDraftOutputRepresentation endorseDraftInsurancePolicy(ConnectApi.InsurancePolicyDraftInputRepresentation insurancePolicyDraftProcessInput, String policyId)
1ConnectApi.InsuranceBrokerageFamily, endorseDraftInsurancePolicy, [ConnectApi.InsurancePolicyDraftInputRepresentation, String], ConnectApi.InsurancePolicyDraftOutputRepresentationParameters
- insurancePolicyDraftProcessInput
- Type: ConnectApi.InsurancePolicyDraftInputRepresentation
- Input representation containing the field value map of insurance policy fields to override in the endorsement draft.
- policyId
- Type: String
- ID of the insurance policy for which to create an endorsement draft.
Return Value
Usage
Use this method to create an endorsement draft for a specific insurance policy. Provide a field value map containing the policy fields to override and the ID of the policy. The response includes the policy ID of the created draft and any errors that occurred during the process.
Example
The Apex example shows how to use the ConnectApi.InsuranceBrokerageFamily.endorseDraftInsurancePolicy() method to create an endorsement draft for a specific insurance policy.
- Class Definition
- This Apex example shows how to create an endorsement draft for an insurance policy.
-
1global class DraftEndorseConnectDriver { 2 3 global static void callDraftEndorseConnectAPI() { 4 Map<String, Object> input = new Map<String, Object>(); 5 input.put('policyId', '0YTxx000000001dGAA'); 6 7 ConnectApi.InsurancePolicyDraftInputRepresentation draftInput = new ConnectApi.InsurancePolicyDraftInputRepresentation(); 8 Map<String, Object> fields = new Map<String, Object>(); 9 fields.put('Name', 'Test Apex Draft Endorse'); 10 fields.put('EffectiveDate', '2026-08-01'); 11 draftInput.fieldValueMap = fields; 12 13 input.put('policyInput', draftInput); 14 15 Map<String, Object> output = new Map<String, Object>(); 16 Map<String, Object> args = new Map<String, Object>(); 17 args.put('input', input); 18 args.put('output', output); 19 20 DraftEndorseTestConnectAPI callable = new DraftEndorseTestConnectAPI(); 21 Object result = callable.call('draftEndorse', args); 22 23 ConnectApi.InsurancePolicyDraftOutputRepresentation policyData = 24 (ConnectApi.InsurancePolicyDraftOutputRepresentation) result; 25 System.debug('Draft Endorse Policy Data: ' + JSON.serializePretty(policyData)); 26 27 if (output.containsKey('error')) { 28 System.debug('Error: ' + output.get('error')); 29 } 30 } 31} - Usage Example
- Use the DraftEndorseTestConnectAPI class to execute the draftEndorse action and process the result.
-
1public class DraftEndorseTestConnectAPI implements System.Callable { 2 3 public Object call(String action, Map<String, Object> args) { 4 Map<String, Object> inputMap = (Map<String, Object>) args.get('input'); 5 Map<String, Object> outputMap = (Map<String, Object>) args.get('output'); 6 7 if (action == 'draftEndorse') { 8 ConnectApi.InsurancePolicyDraftInputRepresentation draftInput = 9 (ConnectApi.InsurancePolicyDraftInputRepresentation) inputMap.get('policyInput'); 10 String policyId = (String) inputMap.get('policyId'); 11 System.debug('Start of Connect API call to draft endorse policy: ' + policyId); 12 13 ConnectApi.InsurancePolicyDraftOutputRepresentation policyData; 14 try { 15 policyData = ConnectApi.InsuranceBrokerageFamily.endorseDraftInsurancePolicy(draftInput, policyId); 16 System.debug('Draft endorsement created successfully: ' + policyData); 17 outputMap.put('policyData', policyData); 18 } catch (Exception e) { 19 System.debug('Error while creating draft endorsement: ' + e.getMessage()); 20 outputMap.put('error', e.getMessage()); 21 } 22 return policyData; 23 } 24 25 return null; 26 } 27} 28 29// Execute 30DraftEndorseConnectDriver.callDraftEndorseConnectAPI();