Reputation: 696
Can anyone tell me why the script below fails in the NetSuite Script Debugger on API Version 2.0? As far as I can tell, the search and the join should be valid based on supported search joins for the customer
record type and available fields on the campaign
record type.
require(['N/search'],
function(search) {
// `leadsource` is listed as a search join for `customer`.
// See https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2022_2/script/record/customer.html
//
// `title` is listed as a field for `campaign`.
// See https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2022_2/script/record/campaign.html
search.create({
type: search.Type.CUSTOMER,
title: 'Customers',
columns: [
'leadsource',
'leadsource.title',
'companyname',
'internalid'
]
}).run().each(function(customerResult) {
// ...
});
}
);
Below is the error I'm getting.
{
"type": "error.SuiteScriptError",
"name": "SSS_INVALID_SRCH_COLUMN_JOIN",
"message": "An nlobjSearchColumn contains an invalid column join ID, or is not in proper syntax: title.",
"stack": [
"each(N/search/searchObject.js)",
"<anonymous>(adhoc$-1$debugger.user:18)",
"<anonymous>(adhoc$-1$debugger.user:1)"
],
"cause": {
"type": "internal error",
"code": "SSS_INVALID_SRCH_COLUMN_JOIN",
"details": "An nlobjSearchColumn contains an invalid column join ID, or is not in proper syntax: title.",
"userEvent": null,
"stackTrace": [
"each(N/search/searchObject.js)",
"<anonymous>(adhoc$-1$debugger.user:18)",
"<anonymous>(adhoc$-1$debugger.user:1)"
],
"notifyOff": false
},
"id": "",
"notifyOff": false,
"userFacing": false
}
Upvotes: 0
Views: 313
Reputation: 1515
replace 'leadsource.title'
to a javascript object { join: 'leadsource', name: 'title' }
search.create({
type: search.Type.CUSTOMER,
title: 'Customers',
columns: [
'leadsource',
{ join: 'leadsource', name: 'title' },
'companyname',
'internalid'
]
})
Or you can also try to reverse the string to 'title.leadsource'
as according to the error it's trying to create a join on the title
field, while it should be on the leadsource
field.
Upvotes: 1