Pasting string of text minus specific characters

The use case is in Salesforce, when we need to update the contents of a Case subject field. There are times when the contents of the Subject need to be edited to remove or add specific text. Example:

"6/26 ERTA ONC MA Passed" is the existing Subject contents. When I open the case in edit mode, I want the snippet to remove "ONC" but retain everything else as-is.

The catch is, the Subject contents can be a variety of strings, so it is not an option to simply locate "ONC" based on its position in a string. Now, I have other similar use cases, but, if I/we can figure out how to accomplish the above, I can adapt the solution to other needs.

Hey @Brad_Hedinger, could you please explain the method you use to determine which parts of the text should be kept or removed?

Really just depends on the snippet being used. So, for the example in this thread, I would use {if:contains(regex to reference the field,"ONC")}

Alright. Can you please clarify your question then?

Sure. When a case in Salesforce is in edit mode, how can Text Blaze delete only part of a string of text from the Case Subject field?

To achieve this, highlight the subject line, copy it, and then use a snippet that modifies the clipboard content to get the desired text.


I thought about doing that. Problem is, the snippet is already using the clipboard function to insert copied text into another field of the case. Thats why I was thinking maybe regex?

Yeah, you should be able to use regex with the site command.
Can you email me with the output of the {site: text} command? I'll help you figure out the regex.

@Dan_Barak1 Figured it out using regex and replace!

{note: trim=yes}{existingsubject=extractregex({site:text}, "Case\n(.*)\nFollow")}{endnote: trim=yes}
{if: contains(existingsubject," ONC ")}{=replace(existingsubject, " ONC ", " ")}{endif}

1 Like