How to sort Accounts by total amount inside business process?

Inside business process, I've got a task to pick the Account with largest total amount of its Invoices. It can't be performed by simply choosing a field. And making custom field "Total Amount" and updating it on products change seems awkward to me.

Is there a better way?

 

Like 0

Like

2 comments
Best reply

Dear Yuriy, 

 

The best option would probably be creating a new field on Account and recalculate it when the new invoice is added. Alternatively, you can loop through all accounts in a process and calculate this number for all of them in a script task, but this wouldn't be an optimal solution. 

Can try reading the invoice object first and then take account id from there and read the account. So while you are reading the invoice, you can sort using the amount.

Dear Yuriy, 

 

The best option would probably be creating a new field on Account and recalculate it when the new invoice is added. Alternatively, you can loop through all accounts in a process and calculate this number for all of them in a script task, but this wouldn't be an optimal solution. 

Show all comments