Just added the Scripting app and am trying to write my first script: to create a new field of hyper-linked text (“Opportunity”) from existing text (“Program”) and url (“Website URL”) fields in my table. I found this suggested solution and adapted it to my table like this:

The problem: it works on only about 10 percent of my records:

I’d appreciate any suggestions for how to make this work for all records, or an alternate method. What is the significance of “selectRecordsAsync” showing as struck through after I run the script? Is this a problem with the script not waiting for calculations? This is my first experience with Javascript.
Scripting: creating hypertext links
Best answer by Justin_Barrett
Welcome to the community, @Dan_Billin! :grinning_face_with_big_eyes: The reason for the strikethrough on selectRecordsAsync can be seen by hovering over that method name. Long story short, that style of calling the method without any arguments—meaning that you want to select all fields for all available records—is being deprecated. After a while, that argument-less way of calling that method won’t work. For now that strikethrough is there to remind users to begin adopting the preferred (soon to be required) syntax, which includes an object where you specify a collection of fields that you want to specifically collect when retrieving those records. Only those listed fields will be available for later operations on that query. (There are other things that can be passed via that same object; refer to the API docs for more info.)
For example, in your code you’re only accessing the {Website URL}, {Program}, and {Opportunity} fields, so you could modify that line to look like this:
let query = await tb.selectRecordsAsync({fields: ["Website URL", "Program", "Opportunity"]});
That’s because you omitted the “await” keyword before the call to the updateRecordAsync method. Long story short, all methods ending in “Async” must be await-ed to function properly.
On a side note, there’s a more efficient way of updating records in bulk instead of updating them one at a time, which would involve using the updateRecordsAsync method instead, but that takes a bit more setup. Search the forum and you’ll find examples of that method in use, or ask and we can guide you if needed.
Login to the community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

