I have a question. How do I look up a related rec...
# suitescript
p
I have a question. How do I look up a related record from a sublist? I am trying the following but its not working: var accountdata = search.lookupFields({ "type": "account", "id": accounttype, "columns": ["accttype"] });
b
depending on the sublist, you might be able to load the record using N/record and get data using a sublist related method
more consistent is doing a search for equivalent data
p
I am trying to do a search. How would I do a search to get the type of the account?
b
recordtype
if you are looking for the column with the label
Account Type
, then
type
p
I am looping through journal entry lines and I need to look up the account type for each line. what am I doing incorrectly?
k
Untitled
You will get account type
b
your questions get weirder and weirder
accounttype is a field on the line sublist
✔️ 1
you dont need to do a search
k
What is your intension to do with it
p
I missed that. thank you!
I am trying to set the journal entry approvals to route differently if its a system generated journal entry
k
var rec = nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId());
use in console to see on any record type
Well, you can check field
isreversal
=
T
then it is system generated
p
do you know if you can filter out rev rec entries by looking at the reversal flag? do you know if a workflow or script runs first?
b
might want to do a search to see who created the record
p
thanks
k
As per my understanding script will be first than workflow
p
great. I think I have a plan now. thank you both for your help!