Billing Central Apex API Developer Reference

ffbc.OpportunityToContractService

global with sharing class OpportunityToContractService

Service class that provides functionality for the Opportunity to Contract integration.

Methods

convert

global static ffbc.OpportunityToContractService.ConvertResponse convert(ffbc.OpportunityToContractService.ConvertRequest request)

Converts an Opportunity record to a Billing Central Contract record by mapping the values as defined by the FFBC Field Mappings metadata. There are multiple types of conversion that can happen, depending on the Opportunity To Contract Configuration metadata. The conversions are:
- New Contract: A new draft contract is created from the details on the opportunity.
- Renewal Contract: A new draft contract is created as a renewal from the details on the opportunity.
- Replacement Contract: A new draft contract is created from the details on the opportunity and the existing contract is ended.
- Upsell Contract: The existing contract is updated with the new lines on the opportunity, and a copy is saved as a superseded contract. Billing documents that are not yet completed are cleared and the schedules are generated for the new contract lines.

Input Parameters

Name Type Description
request ffbc.OpportunityToContractService.ConvertRequest The request to provide inputs to this process

Exceptions Thrown

Value Description
BillingCentralException There are no active Opportunity To Contract configurations.
BillingCentralException There are multiple active Opportunity To Contract configurations.
BillingCentralException The Opportunity To Contract Configuration Opportunity Object field is not referencing the Opportunity SObject.
BillingCentralException The Opportunity To Contract Configuration Process Trigger field is blank.
BillingCentralException The Opportunity To Contract Configuration Process Action field is blank.
BillingCentralException The Opportunity To Contract Configuration Process Trigger field and Process Action field reference the same SObjectField.
BillingCentralException Any Opportunity To Contract Configuration Process Action Value is duplicated.
BillingCentralException The running user does not have permission to update the Contract lookup on Opportunity.
BillingCentralException The Opportunity is converted as a Renewal and the Original Opportunity field is blank.
BillingCentralException The Opportunity is converted as a Renewal and the Contract field on the associated Original Opportunity is blank.
BillingCentralException The Opportunity is converted as a Renewal and the Contract associated with the Original Opportunity is not in Active or Expired status.
BillingCentralException The Opportunity is converted as a Replacement and the Original Opportunity field is blank.
BillingCentralException The Opportunity is converted as a Replacement and the Contract field on the associated Original Opportunity is blank.
BillingCentralException The Opportunity is converted as a Replacement and the Contract associated with the Original Opportunity is not in Active status.
BillingCentralException The Opportunity is converted as an Upsell and the Original Opportunity field is blank.
BillingCentralException The Opportunity is converted as an Upsell and the Contract field on the associated Original Opportunity is blank.
BillingCentralException The Opportunity is converted as an Upsell and the Contract associated with the Original Opportunity is not in Active status.
BillingCentralException The Opportunity is converted as an Upsell and the Contract associated with the Original Opportunity has status different from Active.
BillingCentralException The Opportunity is converted as an Upsell and the Contract associated with the Original Opportunity has an open Change request related.
BillingCentralException The Opportunity is converted as an Upsell and there are too many unbilled data records to clear.

Return Value

OpportunityToContractService.ConvertResponse The response from the service. This could contain errors and successfully created contracts.

ffbc.OpportunityToContractService.ConvertRequest

global with sharing class ConvertRequest

The request object that provides inputs to the convert service.

Properties

Name Type Description
OpportunityIds Set<Id> The IDs of Opportunity records for which to create Contract records.

Methods

ConvertRequest

global ConvertRequest()

ffbc.OpportunityToContractService.ConvertResponse

global with sharing class ConvertResponse extends Response

The response object returned by the convert service. Contains errors and successfully created contracts.

This class extends ffbc.Response

Properties

Name Type Description
ContractsByOpportunity Map<Id, Id> Read only. Maps the ID of each successfully converted opportunity to the ID of the contract associated with it.
© Copyright 2009–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.