Search code examples
sugarcrm

SugarCRM Calculated field using IfElse, needs to return null on true


I have an ifElse function of this construct:

ifElse ( condition, return null, otherwise return today's date )

As things are currently my function returns itself. The field is a date called course_date:

ifElse ( condition, $course_date, today() )

and this returns 0 on condition true. This then causes an error as 0 is not a date and then fails when being submitted.

I would like to know if it is possible to return null or an empty string.


Solution

  • Create another datetime field called null_datetime (for example) with a default value of none.Then change the formula to display that field on true.

    ifElse ( condition, $null_datetime, today() )