<@U2ED4NDEK> What I do and because is only one fil...
# suitescript
a
@jonny What I do and because is only one file that potentially will not change I upload the logo to FileCabinet, make it available without login, use the url as img src
j
Yeah I was hoping to get something a little more dynamic than that, in case they change the logo file. What I'm trying now is that I can get the logo id from the company config file, I can then get the url from loading the file with the file module. Now I'm trying to pass the url as a custom data source using
TemplateRenderer.addCustomDataSource(options)
.
a
Maybe companyInformation is a record and you can also add it as you add salesorder rdcord or itemfulfillment...
j
You can, but it doesn't contain the logo url as a field. You can only get the logo id..
This is how I solved the issue, in case you're interested
Copy code
// Get that pesky logo url
const companyRec = config.load({ type: config.Type.COMPANY_INFORMATION });
const logoId = companyRec.getValue({ fieldId: 'formlogo' });
const logoObj = file.load({ id: logoId.toString() });
const logoUrl = logoObj.url.replace(/&/g, '&amp;');
const logoJSON = { url: logoUrl };
log.debug('Logo URL', logoUrl);

// Add it as a custom data source
theRender.addCustomDataSource({ 
    format: render.DataSource.JSON,
    alias: 'companyurl',
    data: JSON.stringify(logoJSON)
});
a
That good, thanks for sharing...