ReplaceString Function
ReplaceString (text as String, find as String, replaceWith as String, isCaseSensitive as Boolean) as String
Category: | Text |
Description: | Replace all instances of the "find" parameter with the "replace with" parameter within the defined string value. By default isCaseSensitive is equal to FALSE, if set to TRUE then search is case sensitive |
Supported Context: | FormulaField And BusinessRules |
Parameters: | |
text as String | Represents a text string or reference to a field that returns a value of type text |
find as String | Represents a text string or reference to a field that returns a value of type text. Indicates the text value you would like to "find" within the value specified in the "text" parameter |
replaceWith as String | Represents a text string or reference to a field that returns a value of type text. Indicates the text value you would like to "replace" within the value specified in the "text" parameter instead of the value specified in the "find" parameter |
isCaseSensitive as Boolean | This optional parameter allows you to decide if the find and replace action will be Case Sensitive. Accepts a value of "TRUE" or "FALSE", if parameter is not entered then by default the parameter value will be "FALSE" meaning it will not be Case Sensitive |
Returned value as String | Returns a text or string value equal to the text specified in the "text" parameter where the "replaceWith" text replaces the text specified in the "find" parameter |
Example #1 |
Suppose you have a template project with sub-projects, where each sub-project has a prefix in its name (e.g, -Dev, -Marketing), and you would like to replace the with the parent projects name. For example, the parent project is the new product in development, say Widget, so that you would like each milestone to be Widget-Dev, Widget-Marketing. Build a workflow rule on a Milestone Work Item entity, so that the evaluation criteria is Contains($Name," ") && Not(IsNull($ParentProject)) |
Example #2 |
Add the "Update Field" option from the "Set Action" drop down, select the "Name" field and set it's value to be ReplaceString($Name," ",$ParentProject.Name,FALSE) |