<@U01C3RGHB16> array.join("\n")
# suitescript
m
@SG array.join("\n")
s
unable to do with this
m
What happens when you try?
s
function taskDetailsSearch(recid,rec) { try { var invoiceSearchObj = search.create({ type: "invoice", filters: [ ["type", "anyof", "CustInvc"], "AND", ["mainline", "is", "T"], "AND", ["taxline", "is", "F"], "AND", ["internalid", "anyof", recid] ], columns: [ search.createColumn({ name: "internalid", label: "Internal ID" }), search.createColumn({ name: "owner", join: "activity", label: "Owner" }), search.createColumn({ name: "startdate", join: "activity", label: "Date" }) ] }); var cols=invoiceSearchObj.columns; var owner,date; var arr=[]; var str=''; var searchResultCount = invoiceSearchObj.runPaged().count; log.debug("invoiceSearchObj result count", searchResultCount); invoiceSearchObj.run().each(function(result) { owner=result.getText(cols[1]); date=result.getValue(cols[2]); var a =owner +' '+date; arr.push(a); return true; }); arr.join("\n"); log.debug('arr',arr); var id = record.submitFields({ type: record.Type.INVOICE, id: recid, values: { custbody1: arr }, options: { enableSourcing: false, ignoreMandatoryFields : true } }); } catch (e) { log.debug(e.name, e.message); } }
In the custom field : output: Test1 05-Jan-2021 Test1 05-Jan-2021 Test1 05-Jan-2021
m
arr.join returns a string which you are ignoring and then saving the original array to the custom field
In your submitFields call you need to replace
custbody1: arr
with
custbody1: arr.join("\n")
s
okay
let me try this
still unable
e
@SG is your custom field a text area? If it's just a text field, it will be combined into one line.