Tracking a Date & Time Field's History

I found the following article to be incredibly helpful for creating a field that tracks the Name History in Sugar. http://support.sugarcrm.com/Knowledge_Base/Studio_and_Module_Builder/Sugar_Logic/Sugar_Logic_Walkthrough_Tracking_a_Fiel… 

I want to create a similar field that tracks any change made to a date/time field called "Last Phone Call Date"

The original formula for tracking changes made to a name looks like this: 

ifElse(contains($name_history_c,concat($first_name," ",$last_name)),  $name_history_c,concat($name_history_c," ",$first_name," ",$last_name))

I would think the following changes would work to track changes made to "Last Phone Call Date" but I get this error message when I click save: concat: All parameters must be of type 'string'

Did I simply mess up the formula OR can a date/time field not be copied and tracked using a text area field?

ifElse(contains($history_of_calls_logged_c,concat($last_phonecall_c)),$name_history_c,concat($history_of_calls_logged_c," ",$last_phonecall_c))

Parents
  • Hi Kayla Ebert,

    In this case, the issue is not the field type, so good news: this is going to work!

    The issue is that calculated field functions are often limited in the data types they can process.

    The great news is that there are functions that change the data types!

    Try this:

    ifElse(contains($history_of_calls_logged_c,concat(toString($last_phonecall_c))),$name_history_c,concat($history_of_calls_logged_c," ",toString($last_phonecall_c)))

    The toString() function takes the input and changes it to datatype String so the concat() function can then process it.

    This might not work exactly as written (because I did not test this), so come back if it does not with any change (or lack of change) in the error, and we can go from there.

    I hope this helps!

  • This worked, thank you so much!!! I had to make a small change (replaced $name_history_c with $history_of_calls_logged_c in the latter part of the formula. It was grabbing the contact name at first, haha!) 

     

    I'll monitor the field over the next month as see how it performs. I so wish it would input commas in-between values as additional calls are added, simply to make the data easier to read. Is that possible?

  • Hi Kayla Ebert,

    You can put punctuation in " " when concatenating.

    In other words:

    concat("first"," ","second) will output: first second

    WHEREAS 

    concat("first",", ","second) will output: first, second

    If you wish to add a comma at the end of the entry instead, you can:

    concat("first"," ","second,",") will output: first second,

    I hope this helps!

Reply Children