Manuel Toniato
06/08/2020, 5:55 PMrenderer.addSearchResults()
.
If the search is simple everything works as expected: I define the <#list>
tag and I retrieve the fields correctly
The problems arise when I use joined fields and/or multiple formula fields.
If I use joined fields, I cannot find a way to retrieve the field from the template.
If I define more than one formulatext for example, it seems that the latter overwrite the former and only the last defined formula field is available in the template. Take this code for example.
var filters= [];
filters.push(new nlobjSearchFilter("internalid",null,"is", 40556971));
filters.push(new nlobjSearchFilter("mainline",null,"is", "F"));
filters.push(new nlobjSearchFilter("shipping",null,"is", "F"));
filters.push(new nlobjSearchFilter("taxline",null,"is", "F"));
filters.push(new nlobjSearchFilter("accounttype",null,"anyof","COGS"));
var columns=[];
columns.push(new nlobjSearchColumn("externalid", "item"));
column=new nlobjSearchColumn("formulatext");
column.setFormula("{item.custitem_flb_santoni_colore}");
column.setLabel("color");
columns.push(column);
column=new nlobjSearchColumn("formulatext");
column.setFormula("{item.custitem_flb_santoni_taglia}");
columns.push(column);
columns.push(new nlobjSearchColumn("accounttype"));
columns.push(new nlobjSearchColumn("quantity"));
var searchresult = nlapiSearchRecord("transaction", null, filters, columns );
var renderer = nlapiCreateTemplateRenderer();
var f = nlapiLoadFile(doc_config.template_id);
var template = f.getValue();
renderer.setTemplate(template);
renderer.addSearchResults('template_rows', template_rows);
Could anybody help me?
Thanks in advance.scottvonduhn
06/08/2020, 6:06 PMcolumn = new nlobjSearchColumn("formulatext_color");
column.setFormula("{item.custitem_flb_santoni_colore}");
Then, access it in the template as: template_rows.formulatext_color
Manuel Toniato
06/09/2020, 7:26 AM