How to Create a String Formula Field in Zoho CRM
Permission Required
Users with the Field-level Access permission in profile can access this feature.
Create String Formula Field
The following table helps you to understand the type of arguments required for formula functions along with the type of syntax that needs to be formed.
| Len | Returns the number of characters in a specified text string. | Len(string) | Len('abc') returns 3; Len(' abc ') returns 5 |
| Find | Returns the nth occurrence of the text string. | Find('string','search string',number) | Find('greenery','n',1) returns 5 |
| Concat | Returns the concatenation of all the strings. | Concat('string','string',...) | Concat('FirstName',' ','LastName') returns FirstName LastName |
| Contains | Returns true if search string is found in the other string, otherwise returns false. | Contains('string','search string') | Contains('abcdef','cd') returns true |
| Startswith | Returns true if the string begins with the search string, otherwise returns false. | Startswith('string','search string') | Startswith('abcdef','cd') returns false , |
| Endswith | Returns true if the string ends with the search string, otherwise returns false. | Endswith('string','search string') | Endswith('abcdef','ab') returns false |
| Lower | Converts all characters in a string to lower case. | Lower('string') | Lower('APPLES') returns "apples" |
| Upper | Converts all characters in a string to upper case. | Upper('string') | Upper('apples') returns "APPLES" |
| Trim | Returns string with the leading and trailing white space characters removed. | Trim('string') | Trim(' abcd ') returns "abcd" |
| Substring | Returns a portion of an input string, from a start position in the string to the specified length. | Substring('string',n1,n2) | Substring('abcdefg',4,7) returns "defg" |
| Replace | Replaces each occurrence of the search string in the input string with the corresponding replace string. | Replace('string','search string','replace string') | Replace('abcdefg','abc','xyz') returns "xyzdefg" |
| Tostring | Converts any argument to a string data type. | Tostring(generic argument) | Tostring(3.4) returns "3.4" |
| CaseInsensitiveEquals | Compares two strings in case insensitive manner. | CaseInsensitiveEquals(string,string) | CaseInsensitiveEquals('asdf','AsDf') gives result as true; CaseInsensitiveEquals('asdf','AsDg')gives result as false |
| IsEmpty | Checks whether the value is empty or not. | IsEmpty(generic) | IsEmpty('') gives result as true; IsEmpty('asdf') gives result as false; IsEmpty(${Customer.Score}) gives result as true if Score is not entered. |
| DateBetween | Returns the time between two dates where the unit can be years, months, weeks, days, hours, minutes. | DateBetween(date-time,date-time,string) | DateBetween(Newdate(2022,02,10,11,30,'AM'), Newdate(2023,02,19,11,30,'AM'),'years') gives result as 1 |
Note
- The string constants should always be enclosed in single quotes(‘)
- Field labels do not need to be enclosed in single quotes (‘).
- Values of the String data type can be used with == and != operations inside If(), Or(), And(), and Not() library functions.
For example, If (‘abc’ == ‘abc’, ${returnValue1}, ${returnvalue2})
To create String type formula fields
- Log in to Zoho CRM with Administrator privileges.
- Go to Setup > Customization > Modules and Fields. Module refers to the Leads, Accounts, Contacts, etc. tabs.
- Click the required module. The Layout Editor opens.
- Drag and drop the Formula field from the New Fields tray to the required module section on the right.
- In the Formula Properties window, do the following:
- Enter id in the Label field. Select String as the Formula Return Type from the drop-down list.
- Constructing Formulas
- Under Select Functions, select String Functions from the drop-down list.
- From the list of String Functions, choose a function and click Insert. (Alternatively, you can double-click on a function to insert)
- In the Formula expression, click between the parenthesis to insert an argument.
- Under Select Field column, choose a field and click Insert. (Alternatively, you can double-click on a field to insert) Under Select Operator column, choose an operator and click Insert.
- Click Check Syntax to check the construction of the formula.
- Click Save.