I have no experience with scripts so far, so I’m basing this question on what I *think* they’re used for.
I’ve built out a base that takes incoming QR Code requests, which have a simple URL, and uses a formula field to append UTM parameters, and then shows the full URL in an interface which the user turns around and uploads into our QR platform.
We’ve just started working with a new vendor for coupons, and they have some pre-populated UTMs in their URLs. Important to note that this only accounts for a portion of our QR builds. Since they already have UTMs, I can’t use the current formula to create our final URL. I believe my options are:
- Update the current automation to send the URL to one of two formula fields, based on the type of incoming request (this is already captured in a single-select). My concern here is that there will definitely come a time when someone mis-labels their request, which will make the final URL unusable. I think this will be a small use case, but still inevitable. I haven’t nailed down this workflow yet, but I expect I’d also need to then create another field that will consolidate the two final URL fields into one that will show in the interface.
- Use a script in the automation to create the final URL (is this even possible?). This would be more straightforward, as the rule that I need to create is basically “If there’s already a question mark in the URL, do this, if not, do that”. After that initial rule, it’s a bunch of simple substitutions of characters like turning spaces into “%20”
I’m not sure which of these options is the better choice, or if the second one is viable for what I’m looking for. I’m leaning towards the script because I expect it’ll cover future instances of URLs with UTMs already appended - there’s every possibility that some other website my company works with winds up giving us a URL like this. Does anyone have any advice? Any other callouts on things that I’m missing?
More technical info, not sure if this is needed -
Currently I have a form with a few intake fields such as campaign name, launch date, url, etc. Airtable base has a second normalization field for each of these which deletes special characters and spaces, makes everything lowercase, etc. Then a final field concatenates that and adds the same UTM parameters to the end of each. So what I’d really need to add is a normalization field for the initial URL - if that already has UTMs (or if it has a question mark in the URL at all) it’ll need to follow one set of rules to encode the URL; if there is no question mark, we could just leave it as-is or we could encode as well but we’d need to add a question mark at the start of UTMs. I think I’d still need the final Concatenate field after this, but that’s simple.
After writing all this out, I’m realizing that my ideal solution should work for any URL, regardless of whether it’s tagged as a coupon or not.
