Help

Modify AT "find & replace" script to "find & extract & paste"?

Topic Labels: Scripting
426 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Doug_Grauel
5 - Automation Enthusiast
5 - Automation Enthusiast

There's an AT script called "find & replace."  That's great - but how about if instead I find a string of text in a field, copy what follows up until a find another string of text (/BeginAddress Name, Street, City, Zip /EndAddress), then paste that stuff into a different field?  

The point is to take an email before forwarding it into AT, place /BeginWhatever at the front of what you want to copy, place /EndWhatever at the end of it, then when the new record is created in AT, have an automation run that script to grab what's between the "markers," and paste it into another field in that or a different table - like "Address" for example.  

So, for example, I can mark an address anywhere in an email chain, forward it into AT, and have the script extract what I really want from it and put it where I want it to go.  And then maybe delete that forwarded email.

I want to think that the "find & replace" script could easily be modified to "find, copy, and paste, (and maybe delete source record)" by which of course I mean "easily for someone else!"

2 Replies 2

Hmm if you're not familiar with scripting, perhaps you could try using a formula field and "SUBSTITUTE" for this instead?  Could you provide an example of input and expected output?


@Doug_Grauel wrote:

I want to think that the "find & replace" script could easily be modified to "find, copy, and paste, (and maybe delete source record)" by which of course I mean "easily for someone else!"


How easy it would be depends on who that someone else is. There are people for whom the script you want would be very easy to write. Those script writers would not need to modify the existing "find & replace" script; they could just write the script from scratch.

There are some aspects of what you want that are outside the scope of a script, such as getting the email into Airtable to begin with. There are other aspects of what you want that are beyond what the example script does, such as creating a new record a new record, deleting the existing record, and extracting the text between the delimiters. There are yet other aspects that are different from the example script, such as removing user input from the script and potentially moving the script to work as an automation versus in scripting extension.

It is also possible to use a formula field to calculate the text you want to extract and an automation to put that text in a new records. There are several functions that could do this. My personal favorite would be to use REGEX, but it is also possible using a combination of FIND() and MID(). Deleting the initial record would still require a script as there currently is no native action for deleting a record.

What are your exact goals? Do you want to write the script yourself? Do you want to learn how to write scripts? Do you want to hire someone to write the script for you? Do you want someone else to write the script for you for free? Do you want the text extracted to a new record and don't care if there is a script?