Ben Hamilton

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: ifElse(isBefore(today(),$bluecard_expiry_c),”Current”,”EXPIRED”) However, the problem here is that when a user of SugarCRM is editing the record, there is a known bug that means […]

Posted in How to, SugarCRM | Tagged , , | Comments Off on Sugar Logic bug with a workaround for date fields

Sugar logic to calculate days an opportunity has been open

We want to find out how many days an Opportunity in SugarCRM has been open, using a calculated custom integer field in SugarCRM Studio. I’m assuming you’ve already created a new custom integer field, likely called something similar to “Days open”. The sugar logic to calculate the difference between two dates is this: abs(subtract(daysUntil($date1),daysUntil($date2))) and […]

Posted in General, How to, SugarCRM | Tagged , , | Comments Off on Sugar logic to calculate days an opportunity has been open

SugarCRM how to calculate a persons age

In SugarCRM we oft record a persons birth date (in the field birthdate). Sometimes it’s useful to know how old this person is. So we create a new field age_c (note: this can be of field type Integer or Decimal) and then using this formula we can see how old they are: floor(divide(subtract(daysUntil(today()),daysUntil($birthdate)),365.242)) If you use […]

Posted in How to, SugarCRM | Tagged , | Comments Off on SugarCRM how to calculate a persons age

SugarCRM field visibility dependant on multiple values

I’ve often got cause to make fields in SugarCRM (Professional and Corporate editions) to only appear based on the value of another field. We can do this easily using SugarLogic in Studio using this ‘dependant’ formula: equal($fieldname_c,”value_1″) However today I need to make this particular field visible if the field it is dependant on is one […]

Posted in How to, SugarCRM | Tagged , | Comments Off on SugarCRM field visibility dependant on multiple values