I want to do something like this:
Total value of this fields multiplied by filed = custom field sum.
Is it possible to make it?
F.ex: amount*probability=sum
I want to do something like this:
Total value of this fields multiplied by filed = custom field sum.
Is it possible to make it?
F.ex: amount*probability=sum
There are various ways to achieve it, but they all may have some problems.
Here are some examples:
after_ui_frame logic hook
With this method you can inject some javascript that does the calculation when an event occurs (for example onchange). When you save the calculated value is saved too.
Among the drawbacks: it will probably not work if you use inline editing, so you will have to find ways to update your calculated field when inline editing is used. Or maybe you will have to disable inline editing for the fields that are used in the calculation.
after_save logic hook
Similar to above, except that the calculation is executed via php. Same issues with inline editing
workflow
I am not sure it is possible to do calculations with workflows, but, if it is, you may use this method that requires no programming.
Drawbacks: the results will be updated with some delay so, if you try to use the records before the workflow has run you may end up with wrong data being used.
Depending on the number of records implied you may end up using plenty of system resources.
Same issues with inline editing.
scheduler
In this case itβs like a programmatic version of a workflow, which gives you a little more control.
new calculated field type
I believe that there are commercially available calculated field types. These imply a cost. Alternatively you can try to develop your own calculated field type (and possibly share it with the community or contribute it to the project). In any case also with this method you will probably have issues related to inline editing.
a combination of some of the above
check these posts:
http://stackoverflow.com/questions/38370971/sugarcrm-invoice-add-logic-hook-to-calculate-line-price
http://stackoverflow.com/questions/20966827/sugarcrm-calculated-field
https://community.sugarcrm.com/thread/23554