Hello! I've been creating a pipeline to connect Salesforce and Quickbooks. I've gotten stuck on adding the Discount to the Quickbooks discount. Does anyone have any experience they can offer? ...
It varies. At least one line item, but if the customer orders multiple products, then multiple line items. And there isn't always a discount. I have an IF branch in my pipeline to check if there's a Discount on the originating Salesforce Order. If there is, I need it to add a discount to the Quickbooks invoice.
After reading this community post, I think that with the Create an Invoice action you have to create the "Lines" from a list object, and if that is the case, a discount will need to be one of those in the list object.
You might have to leverage Jinja2 to dynamically chose the "Detail Type"
This statement will check to see if the current iteration of b.name contains the value "Discount" (this could be replaced with any other conditional statement). When the condition is true, it will return Discount value, otherwise the item detail.
That or you could potentially add an if action to add the discount line item after the initial invoice is created using the Update an Invoice action.
I don't have any issues with adding multiple lines items. I have a search element that brings in all my different products and adds them to the invoice without issue. I do have an if branch for IF discount is populated (it's a field, not a line item in Salesforce), then add a discount line item. That branch is where is fails saying discount line item detail is missing from request.