Custom Calculated Field examples

With custom calculated fields, you can create mathematical formulas using C# (C sharp). The formulas and their resulting values are based on the data in your records.

Below are some examples of custom calculated fields and their use cases. We know that many of our users are not familiar with C# (C sharp) or any other C programming language. Don't worry - you can start using these formulas even if you have no coding knowledge.

Just copy and paste the formulas below into the Field Formula text box when you are creating a field.

Disclaimer: Insightly provides this article for informational purposes only. 

Example #1: Lead Assignment Status

Use this formula to verify a lead record's assignment status.

if (Record.Reassigned_to__c != null && Record.New_Appointment_Date__c != null) {  return "reassigned"; } else if (Record.Assigned_to__c != null && Record.Appointment_DateTime__c != null) {  return "assigned"; } else { return ""; }

Example #2: Number of Days from Forecast

This formula can be used to calculate how many days between the today's date and the forecast close date.

return (DateTime.Today - Record.FORECAST_CLOSE_DATE).TotalDays

Example #3: Target Completion Date

Use this formula to add 30 days to a record's creation date to serve as the target completion date.

return Record.DATE_CREATED_UTC.AddDays(30);

Example #4: Last Updated By

Use this formula to determine which user last updated a record.

 a = (CurrentUser.FIRST_NAME); String b = (CurrentUser.LAST_NAME); return (a)+" "+(b);

Example #5: Return Today's Date when a Field is Updated

Use this formula to update the date time field when a record has been updated.

DateTime dt = DateTime.Now;   return (dt.ToUniversalTime())

Example #6: Video - How to Setup Calculated Fields

Example #7: Video - Record Age

Example #8: Video - Multiplication

Was this article helpful?