From Indrajeet Sengupta: Example to implement e-invoicing with Revenue Cloud
Demonstrates how to implement e-invoicing with Salesforce Revenue Cloud using Vertex Netherlands as an example. It guides through preparing the Salesforce org by creating invoice fields and platform events, then using flows to trigger events for middleware processing. The article includes sample Python code to consume Salesforce platform events, perform composite API calls to fetch invoice details, transform data into Vertex’s required format, and send invoices to Vertex for compliance. It also covers updating Salesforce with status responses from Vertex and polling for invoice approval. This approach decouples Salesforce and middleware for scalable, robust e-invoicing.
- Create custom invoice fields and platform events to track e-invoicing status.
- Use record-triggered flows to publish platform events for decoupled middleware integration.
- Consume Salesforce events and call composite API to retrieve complete invoice data.
- Transform invoice data into Vertex’s e-invoicing XML format for the Netherlands.
- Send invoices via Vertex API and update Salesforce with response statuses asynchronously.
So for the sake of clarity, we will use an example for Vertex Netherlands to comply with E-Invoicing Let’s prepare the org. The first thing that we do is create fields on the Invoice level to get the org ready. Help article showing how to create custom fields in Salesforce: https://help.salesforce.com/s/articleView?language=en_US&id=platform.adding_fields.htm&type=5 Here are the fields that we will create on the Invoice Object: E-Invoicing Status: Pending: The invoice has been created but is not yet ready for submission.(Draft Status of Invoice) Canceled : DRAFT invoice not used, so canceled it. Ready for E-Invoicing: The invoice has been finalized and is ready to be sent to the network. This status will be our trigger. Sent to Network: The middleware has successfully sent the invoice data. Acknowledged by Network: The network has received the invoice and confirmed its validity. Approved: The invoice has been approved by the tax authority (for clearance models).