Account value based on closed won contracts

Hi there,
I am quite new to SuiteCRM, so please point me in the right direction if this already has been asked here.

I am trying to make a calculated field based on the values of the Closed Won contracts. So I want to fetch the total amount of the running contracts and add that to one field on an account level.

Is this something that can be configured out of the box? If yes, how could I manage this?

Many thanks,
Robin

Hi, welcome to the Community :tada:

I don’t think Calculated fields have the ability to make calculations aggregating many values into one.

You’d have to use a bit of custom code, I recommend a logic hook. Do you need the value to appear where?

If you use Reports, they do aggregate totals. But to show on the screen it’s a different thing.

And if it was meant for email campaigns, then you could use my add-on PowerReplacer.

1 Like

Hi, thanks!

I need it to appear on an Account-level. Are there any sources where I can look for existing logic hooks that aim to do something similar?

There might be differences if you need to show it for each account in…

  • list view
  • detail view
  • subpanels of other records

Which is it? So I can advise you with more precision on where to put your code.

About the actual calculus, I would probably go with a direct query to the database, not the most elegant solution, but fast and simple. You can Google for direct SQL access in SuiteCRM, you’ll find examples.

1 Like

I’d like to show it on the detail view.

Ok, so instead of a logic hook let’s go with an override of the View class:

Also, have a look at the links inside that thread.

For background information you have the Developer Guide:

Typical chapters you will want to read are the ones about the Extension Framework, Working with Beans, Logic Hooks.

I do appreciate your replies. I think this is a bit above my technical understanding of things as I am not a developer and was hoping for a clear step tutorial or someone who already had accomplished the same.

Thanks for your effort in any case!

Have a look at the Reports module. It’s a bit complex sometimes, but at least it’s all drag-and-drop, intended for end-users. You won’t get the information visible on the detail view, but at least you should be able to get a list of totals by account.