Sugar Logic bug with a workaround for date fields

A client is recording the expiry dates of staff blue cards in their SugarCRM database.

So I used the following sugar logic to show if the blue card has expired or not:

However, the problem here is that when a user of SugarCRM is editing the record, there is a known bug that means it will display “EXPIRED” regardless of if the date is in the past or future.

The workaround for this bug (thanks Anthony) is to wrap the date field in a date(toString($datefield)) bit of code, this transform the original sugar logic into this:


It is essentially force-casting the field to a date field for the javascript-side while passing the formula validator in Studio by first casting the date-type field to a string type.

Which works a treat.

Remove thousand separator in Integers in SugarCRM

We want to record a ‘Year’ value on a record in SugarCRM, but we don’t have a day and month to do with it, you can’t use a field that is of a ‘date’ type as that requires a full date (year, month, day).

You can use an ‘Integer’ field type tho. The downside is that it displays a thousands separator. i.e. it’ll show 2,014 instead of 2014.

To fix this, tick the Disable Format check box in Studio. This will remove the thousand separator.

Screenshot 2014-02-05 13.05.04