Using the Concat Function in Sugar

by Katie Liesmann on July 16, 2015

The concat function can be intimidating, but if you start with the basics you can gain confidence to create more complicated formulas.

Basic Rules

Concat is a type of calculated field in Sugar that allows you to take multiple text values and push them together. Like other calculated fields, you create a concat field using Sugar Logic. Here are the rules you need to know before creating a calculated field:

  1. Separate the pieces you want to be concatenated by a comma.
  2. Any field you put into a concat function will have a dollar-sign in front of it to indicate that it is a variable field.
  3. To insert text that doesn’t change, put it in double quotations. For example, if you want to put a dash between two fields, type “-”.
  4. Concat fields only work with text, not numbers. If you want to pull a number into the field, such as a date or amount, you must use what is known as a “toString” that allows the concat field to read it as text.

Examples of Using the Concat Function

1. The concat function can be used to pull together two text fields and display them in the same field. For example, you may want to pull together the Billing City and Billing State Fields to be displayed as “City, State”. Below is the Sugar Logic needed to create that field. Another use-case would be to create a “Last Name, First Name” field.

concat ($billing_address_city,”,”$billing_address_state)


2. Another way to use the concat function is to create consistent naming conventions across your organization. This can be used when creating a new record (meeting, call, task, case, etc.) to save users time and also make records easy to search on. Below, we show the Sugar Logic in the example of pulling in other fields to automatically create the subject for a new case. This Logic automatically sets the subject of the case with the Account Name, Case Type, and Date Entered.

concat (related($accounts,”name”), ” - ”, $case_type_c,” - “, toString($date_entered))


3. A more complex way to use the concat functions is in combination with “If-Then” statements. An If-Then statement used in Sugar Logic instructs Sugar to do one thing if scenario A is true, and a different thing if scenario B is true. An example of this would be creating a custom field within your cases module that displays certain values depending on if the case is still open or not. In the Sugar Logic below, we display the text “closed” and pull in the last modified date if the case is closed. If the case is still open, we pull in the type of case it is and the number of days it has been since it was created. This can be used in a custom field to be displayed within a module or even to be pulled into a custom weekly report.

ifElse(equal ($status, “Closed”), concat (“Closed”, “ - “, toString($date_modified)), concat($Status, “ - “, toString(multiply (daysUntil ($date_entered), -1)), “ Days”))

Sugar Logic is complex, so if you have questions about any of the Sugar Logic above or are interested in having us create custom logic for you, contact us here.

Find similar articles in these categories:


AUDIENCES: End Users Administrators

Katie Liesmann
Marketing Manager at UpCurve Cloud
More From This Author »