Update field from change of another field

I created a custom field named of parcelas_c on quotes modules, and i am trying to update the amount field when i change the value of the parcelas_c field! I already try to put a custom js code, and i didnt work

Hey gabriells1234

This is easy. Create a workflow on that module (menu All->Workflows), check Only on Save, then create the condition (for example, on any change on field parcelas_c), then create an action of Calculate Field type and put the fields parcelas_c, etc, as parameters and then the formula, like {P0} * {P1}.

Please refer to the documentation for further details:

https://docs.suitecrm.com/user/advanced-modules/workflow/

(pelo seu nome e pelo nome do campo, acho que você é brasileiro!!)

Rgds

1 Like

I tried with workflow, but didnt work! I dont know if i did something wrong in workflow!
My workflow:
Run: only on save
Run On: Modified Records
Condition: parcelas_c equal to any change
action: calculate fields
formula {P1}/{P2}
Where P1 is my subtotal and P2 is parcelas_c

(eu sou brasileiro sim!!)

Apparently the problem is with my formula, when I save the quote, it changes the value of the amount to the value of the {P1} variable

You must use math functions. In your case, Div, please see below:

{divide(parameter1; parameter2)}

Take a look in the calculated fields documentation:

https://docs.suitecrm.com/user/advanced-modules/workflow-calculated-fields/#_divide

Also, you can check if the workflow worked or failed. In the workflow detail view, scroll down and check the audit records.

Rgds

1 Like

Worked now!! But they dont show the value when i change the value, just show the the after save the quote!

Yep, it is how it works.

On line, you’ll need to dig into the javascript.

can you help me, how to change this in js?

Check this post for some ideas:

https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/17302-changing-the-functionality-of-the-inline-edit

thnks! Ill try do this with ajax!