How to us Calculated fields

I am trying to use the calculated fields in the workflow and have had some success but I just cannot get the ifThenElse or the greaterThan to work.

I can see from the documentation {greaterThan(parameter1; parameter2)} & ifThenElse(condition; trueBranch; falseBranch)}

What I have is ifThenElse({greaterThan(P0; 6)}; 999; 99)}

P0 is an integer. I just don’t get anything returned if I use the add(P0;99) I get a correct result.

This is how I have set it up

I would be very grateful for some advice

Hi,

greaterThan

  • Signature {greaterThan(parameter1; parameter2)}
  • Parameters_
    • parameter1: can be any value of any type
    • parameter2: can be any value of any type
  • Description: Determines if parameter1 is greater than parameter2
  • Returns: 1 if parameter1 is greater than parameter2, 0 if not
  • Example call: {greaterThan(3; 3)} returns 0

ifthenelse:

  • Signature: {ifThenElse(condition; trueBranch; falseBranch)}
  • Parameters
    • condition: logical value
    • trueBranch: any expression
    • falseBranch: any expression
  • Description: Selects one of the two branches depending on condition
  • Returns: trueBranch if condition is true, falseBranch otherwise
  • Example call: {ifThenElse({equal(1; 1)}; 1 equals 1; 1 not equals 1)} returns 1 equals 1

combined example:

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

1 Like

Thank you much for your assistance I will have a go and see if I can get it to work with the information you have kindly provided