Manuel Toniato
06/08/2020, 5:30 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 within 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.daniel_w
06/17/2020, 8:49 PMdaniel_w
06/17/2020, 8:51 PM