is there a way to find record type by internalid o...
# suitescript
j
is there a way to find record type by internalid or any other method, use case is that I need to update resource cost on projects, and a resource can be an employee or a vendor, there is no search column which provides that, so all i have is internal id to lookup and get values, can we get record type by internalid or any other way in ss1 or ss2 ?
e
Can you not search on entity?
m
message has been deleted
@ec Haha beat me to it 😆
e
But, @michoel your response was probably more helpful - screenshot and all! As always...
m
Theoretically the same entity could have multiple record types, for example via "Other Relationships" a vendor and customer could share the same internalid. But I don't think a vendor and employee could
j
if you search entity you dont get labor cost and other required fields - the search is pretty limited - moreover i have to do a load record -
m
You would search to get the record type to load. This came up on here before, and the other way to do this is try/catch loading the different record types, which I benchmarked and it's surprisingly faster than a search in fact
j
hmm.. thanks all, seems netsuite deliberately locks out missing important pieces, dont have any thing to update new costs to project task assignments
m
Yep I actually still have that code in my chrome snippets
j
no mass update, no csv, no direct search, complex coding seems to be only option
can you share - it would save me some time - i will owe you one 🙂
m
message has been deleted
Copy code
require(['N/search', 'N/record'], (search, record) => {
    console.time("lookupFields");
    console.log(search.lookupFields({ type: search.Type.TRANSACTION, id: 21295252, columns: 'recordtype'}))
    console.timeEnd("lookupFields");
    
    console.time("recordload");
    try {
        console.log(record.load({ type: record.Type.SALES_ORDER, id: 21295252 }));    
    } catch(error) {
        console.log(error);
    }
    console.timeEnd("recordload");
});
j
oh - actually i meant cost update script
thanks anyways for all your valuable inputs
m
Oh sorry, I haven't touched projects / tasks before
j
its a mess - strangely not even exposed to search, csv, update or even suiteanalytics
m
Sounds fun 🙃