Skip to main content

Hello Community!

I have run into a perplexing issue when trying to automate attachment field updates or use script extensions to convert a url to an image asset.

In my automation script I follow these steps:

- make call to external api to get order data

- pass that data to a function

- the function preps the data and creates an object that holds the table field names as keys and the response data as values.

 

 

// values come from parsing the api response data and assigning that data to variables
// ex. let recordName = data.name

let myObj = {
"Order #": recordName,
"Part Name": part_name,
"Order QTY": quantity,
"Image Url": image,
"Image": [{url: image}],
}

 

 

 
- The object is then passed as an argument to createRecordAsync():

 

table.createRecordAsync(myObj)​


All the values populate correctly except for the image. I get a placeholder image and when I click into it, it displays a broken image link icon.





 

 

If I hard code a url in the automation script everything works as expected. 

If I manually click "add attachment" in the Image field then copy and paste in the value of the Image Url field as a Link(url) everything also works as expected. 

What am I missing?

Please let me know if you need more details
Thanks in advance.

 

Hi @mcordier ,

Is there an "await" for asynchronous processing as follows?

let recordId = await table.createRecordAsync({
"Date": "Hello world!",
});

 


Hi @mcordier ,

Is there an "await" for asynchronous processing as follows?

let recordId = await table.createRecordAsync({
"Date": "Hello world!",
});

 


Hi Sho,

Yes, the createRecordAsync has the "await" keyword in front of it. It's wrapped in a try/catch. I'm passing the object that was created from the external api response 

...

let myObj = {
"Order #": recordName,
"Part Name": part_name,
"Order QTY": quantity,
"Image Url": image,
"Image": [{url: image}],
}

try {
await table.createRecordAsync(myObj)
} catch (error) {
console.error("CREATE RECORD ERROR: ", error);
}

 


Reply