Vedachalam Mahadevan
03/22/2025, 6:39 AMCeligo AI
03/22/2025, 6:39 AMAI generated answer (using internal Slack threads):Yes, you can attach an expense media file using SuiteScript and a file URL. Here's a step-by-step guide on how to do it: 1. First, you need to get the file from the URL. You can use the
N/https
module to send a GET request to the URL and retrieve the file. Here's a sample code snippet:
javascript
var response = https.get({
url: '<your_file_url>'
});
2. Once you have the response, you can use the response.body
as the contents when creating the file. You can use the N/file
module to create a file in the File Cabinet. Here's a sample code snippet:
javascript
var fileObj = file.create({
name: '<file_name>',
fileType: file.Type.<FILE_TYPE>,
contents: response.body,
folder: <folder_id>
});
3. After creating the file, you can attach it to the expense report line item using the record.attach
method. Here's a sample code snippet:
javascript
record.attach({
record: {
type: 'file',
id: fileObj.id
},
to: {
type: 'expensereport',
id: <expense_report_id>
}
});
Please replace <your_file_url>
, <file_name>
, <FILE_TYPE>
, <folder_id>
, and <expense_report_id>
with your actual values.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/22/2025, 6:40 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819604039
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80303514
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.799041808
Celigo AI
03/22/2025, 6:40 AM