How to create logic hook in SuiteCRM Opportunities to calculate Probability (%) based on Sales Stage Value, plus calculate Expected Revenue.

In the Opportunities I’d like to be able to automate the calculation of the Probability (%) based on Sales Stage Value. For example:

Sales Stage Picklist Values:
Stage 1 = 0%
Stage 2 = 10%
Stage 3 = 20%
Stage 4 = 40%
Stage 5 = 70%
Stage 6 = 90%
Stage 7 = 100%

So if Stage 5 were selected in Sales Stage then the value displayed in Probability (%) would be 70%.

Plus, I’d like to calculate and display an Expected Revenue in that custom field based on Opportunity Amount times Probability (%). For example:

Opportunity Amount: $10,000 X Sales Stage 4: 40% = Expected Revenue: $4000

Your first request is already implemented, is you changed the Sales Stage values then you also need to modify some values in dropdown editor

Your second request you can achieve with logic hooks, if you don’t have a clue what is that let me hint you with some documentation

best regards

Hi Mike,

I think my request for the probability % may have been unclear. What I’d like to have happen is, for example, by selecting “Needs Analysis” from the Sales Stage menu the Probability (%) would automatically update with a predetermined percentage, e.g., 30%. Right now the Probability (%) has to be manually updated.

On the second part, I do know what logic hooks are and I was hoping someone with experience creating them could offer some sample code.

I repeat, your first request is already working in SuiteCRM out of the box, can you test it in a clean install? for your second request take a look at my answer in your other post regarding logic hooks, you can achieve here with almost the same method

best regards

My mistake. You’re right. The % updates in edit view. I was changing the drop menu values in quick edit mode which does not change the value of the Probability %. Do you know where those % values are set in SuiteCRM?

Admin -> Dropdown Editor -> sales_probability_dom

best regards

thank you!