Slackbot
02/04/2020, 10:28 PMmichoel
02/04/2020, 10:55 PMmichoel
02/04/2020, 11:25 PMmichoel
02/04/2020, 11:26 PMmichoel
02/04/2020, 11:30 PMmichoel
02/04/2020, 11:31 PMmichoel
02/04/2020, 11:32 PMmichoel
02/04/2020, 11:33 PMexport function render(context: EntryPoints.Portlet.renderContext) {
context.portlet.title = 'Sales KPI';
let html = file
.load({
id: 'SuiteScripts/Dashboard KPI/assets/mos_dashboardkpi.html',
})
.getContents();
const monthlySalesPercent = calculateMonthlySalesPercent();
const yearlySalesPercent = calculateYearlySalesPercent();
const { lowerTarget, upperTarget } = calculateDailyTarget();
const dailyTarget = `${lowerTarget}-${upperTarget}`;
const dailyTargetMet =
parseFloat(monthlySalesPercent) >= lowerTarget ? 'true' : 'false';
html = html.replace('{{salesPercentMonth}}', monthlySalesPercent);
html = html.replace('{{salesPercentYear}}', yearlySalesPercent);
html = html.replace('{{dailyTarget}}', dailyTarget);
html = html.replace('{{dailyTargetMet}}', dailyTargetMet);
context.portlet.addField(
{ type: ui.FieldType.INLINEHTML, label: 'Inline HTML', id: 'inlinehtml' }
).defaultValue = html;
}
michoel
02/04/2020, 11:36 PMmichoel
02/04/2020, 11:41 PMmichoel
02/04/2020, 11:41 PMKevinJ of Kansas
02/05/2020, 4:53 AM