In this post, we’re diving into a powerful feature of Salesforce CPQ: the Quote Proposal API. This API allows you to generate quote documents more efficiently, either through custom Lightning Web Components (LWC) or Salesforce Flows. If you’re tired of using the default Visualforce page to generate documents, this solution is for you.
Traditional Document Generation in CPQ
Typically, generating documents in Salesforce CPQ involves navigating to the quote, selecting “Generate Document,” and interacting with a custom Visualforce page. While this method works, it can be cumbersome and slow, especially if you need to generate multiple documents or want a more streamlined interface.
Introducing the Quote Proposal API
The Quote Proposal API simplifies this process by enabling asynchronous document generation directly from your custom interfaces. Instead of navigating through multiple screens, you can initiate the document creation process with a few clicks.
Here’s how it works:
- Asynchronous Job: When you call the API, it starts an asynchronous job in the background to generate your document. The job ID returned allows you to track the document’s generation status.
- Custom Interface: You can create a custom interface using Lightning Web Components or Salesforce Flow to call this API. This eliminates the need for the standard Visualforce page, offering a more seamless user experience.
Practical Implementation: LWC and Flow Integration
In our YouTube video, we demonstrated how to implement this API in a custom LWC. The LWC allows users to select the document name and template and then generate the document with a single click.
Here’s a quick overview of the process:
- LWC Interface: Users can select the document name and template from the custom LWC interface.
- API Call: The LWC calls the Quote Proposal API, passing parameters such as document name, template ID, and quote ID.
- Background Job: The document generation process runs as a background job, and you can track its progress using the job ID.
- Flow Integration: Alternatively, you can also integrate this API with Salesforce Flow, allowing for even more automation in your quote generation process.
Full Code Example
We’ve shared the full code for the Lightning Web Component and the Apex class on our community site. Here’s a snippet of what you can expect:
- Apex Class: Handles the API call and job tracking.
- LWC: Provides a user-friendly interface for generating documents.
- Flow Integration: Example of how to call the Apex class from a Salesforce Flow.
You can download the code here and try it out in your own Salesforce environment.
Conclusion
Leveraging the Quote Proposal API is a game-changer for Salesforce CPQ users who need a faster, more efficient way to generate quote documents. Whether through LWC or Salesforce Flow, this API offers the flexibility and power to streamline your document generation process.
For a detailed walkthrough, check out our YouTube video. And don’t forget to subscribe for more tips and tutorials on Salesforce CPQ!