Sum on invoice items based on invoice

Dear community,

I have an issue summing up data of invoice lines from an invoice data type I created. I tried to have the same logic as the replies on this question but I end up having a blank number.

All my fields are numbers it looks like the “search for” is not working properly.

Any ideas ?

If the steps before number 7 are calculating the necessary numbers for the step 7, it won’t work. When you schedule an API workflow, it will run asynchronous, so you may not get the response or changes right away.

1 Like

In your backend workflow for creating the invoice items you need to add actions, so that after all invoice items are created you do the totals you currently have as step 7.

1 Like

Thanks guys.

This seems indeed to be the issue: I created the same logic as in step 7 but in a separate API workflow to run it manually when “invoice items” are created, it works like a charm.

My app’ will create invoices automatically: how to have step 7 run only when the "invoice items " are created ?

EDIT: I am going to look at this thread that seems to have the same issue that I have.

1 Like

For history, here is what I did to resolve my issue.

As my invoices are created by a backend workflow, all the elegant tricks using conditions like adding a boolean return data at the end of the API workflow action and having a condition in the invoice "if API success variable is “yes” (or not empty) in invoice creation workflow did not work.

The only trick that worked was creating a custom event that is call the API workflow to create invoice lines. It’s pretty wild and ugly to look at. If anybody has a better trick: you are more than welcome.

The issue I had then was on the title of the invoice line as " rich text" is not supported in “Custom Events”. Here I used a “seach for” and the method “format as text”. In the “fomat as text” I could do what I want. I added a delimiter “::”. Then I added a split by “::” as a method + “first item”. Same, it’s ugly but works. Same : if anybody finds a better way, I opened to change.

The above would work. Did you try to implement it? If you did and it didn’t work, share screenshots so I can point out where you went wrong with it.

I don’t think that exactly what I did but the following works:

The last step is basically the recommendation I made, although there may be ways to improve the previous steps, but at the end of the day, if it works, it works. Glad you got it figured out.

Still, I found it pretty “ugly” as I need to call “customer events” that themselves call “API workflows”…

I don’t worry about the way things ‘look’, just that they function and do what they need to do.

1 Like