Help

Re: URL to assets - only creates placeholder image

495 0
cancel
Showing results for 
Search instead for 
Did you mean: 
mcordier
5 - Automation Enthusiast
5 - Automation Enthusiast

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.


Screenshot 2023-10-25 093253.png


 

Screenshot 2023-10-25 093949.png

 

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.

 

2 Replies 2
Sho
11 - Venus
11 - Venus

Hi @mcordier ,

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

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

 

mcordier
5 - Automation Enthusiast
5 - Automation Enthusiast

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);
}