@Cedric_Debono_Blaze Can regex be used to delete text from a field? Example: I have a Salesforce case with text fields open for editing. There is text in the subject field that I want to have deleted (or replaced with . I can simulate keypresses to repeat the backspace key 26 times but that is slow & cumbersome. I am looking for a solution that when I run a snippet, it looks for a string of text and deletes it. Possible?
You can delete parts of text with Regexs, but you can't use them to directly manipulate the page.
So if you had a text on the page with some text you would need to delete it with key commands.
Rather than deleting in character by character, a faster approach might be to select all ({key: ctrl-a} or command-a on a mac) and do a single backspace to delete it all at once, and then insert your replacement text.
Gotcha. Yeah I use that method wherever I can. My use case here is interesting I think. I have snippets that create new cases in Salesforce. There are critically important data points that are not presented on the screen though until after the case is created, because the data pulls from the SF Contact tables. Therefore, I have a 2-snippet approach.
Snippet 1:
Creates the case.
When case is displayed, there is a wait command followed by a series of simulated key presses that are Salesforce shortcuts to get the new case opened in edit mode.
The cursor is automatically placed at the end of the Subject field that is now an "open for edit" text field.
The last step of this first snippet is to put a string of text and the cursor in the Subject field that is only there as an instruction to the user to now trigger a 2nd snippet. It says "TYPE *9 ON YOUR KEYBOARD NOW!"
Snippet 2:
The user presses *9 as instructed to run the 2nd snippet.
This starts a {repeat: 29}{key: backspace}{endrepeat} that deletes the instructional message above, 1 character at a time.
Then tabs down to the case Description, adds a couple blank lines at the top, and pulls in needed data points via regex because those data points are now visible on the screen where they were not when the case was initially created.
For step 2.2, can you do {key: ctrl-a}{key:backspace} (assuming you are on Windows, adjust if you are on Mac) do delete all the text in 2 key strokes instead of 29?
No - because I do not want to delete the entire subject contents. Just want to delete the note telling the user to run the 2nd snippet. And, it is that 2nd snippet that pulls in the needed info via regex.
That actually works fairly well! Only issue I am encountering in testing is if I have another case tab open in edit mode. This snippet replaces the Subject contents with the contents from the other open case. Hmmm...