John Cusick
11/01/2024, 5:16 PMCeligo AI
11/01/2024, 5:16 PMAI generated answer (using internal Slack threads):To add the subsidiary logo in the top left corner of an Invoice Advanced PDF via source code, you can use the
render
module in SuiteScript. You need to load both the invoice record and the subsidiary record, and add them to the render object. Here is a sample code:
javascript
// prepare render object with invoice record and subsidiary record
const rendererObj = render.create();
const invoiceRecord = record.load({
type: record.Type.INVOICE,
id: nsInvoiceId,
isDynamic: false,
});
rendererObj.addRecord({ templateName: "record", record: invoiceRecord });
const subsidiaryRecord = record.load({
type: record.Type.SUBSIDIARY,
id: invoiceRecord.getValue("subsidiary"),
isDynamic: false,
});
rendererObj.addRecord({ templateName: "subsidiary", record: subsidiaryRecord });
rendererObj.setTemplateByScriptId({ scriptId: InvoiceAPISettings.InvoiceAdvancedPDFTemplateScriptId });
// render PDF file and save it to folder
const invoicePDFile = rendererObj.renderAsPdf();
In your Advanced PDF template, you can use the following code to display the logo:
html
<td>
<#if subsidiary.logo?has_content>
<div top="-20">
<img src="${subsidiary.logo@url}" style="width: 230px; height: 40px;" />
</div>
</#if>
</td>
This code checks if the subsidiary logo exists, and if it does, it displays the logo with a specified width and height.
******
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
11/01/2024, 5:16 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838391185
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832353294
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813845515
Celigo AI
11/01/2024, 5:16 PMCeligo AI
11/01/2024, 5:20 PMCeligo AI
11/01/2024, 5:20 PM