is it possible to make 2 joins in a search column?...
# suitescript
r
is it possible to make 2 joins in a search column? like lets say, there is 1 employee search. I can get RM of the employee by using
Copy code
new nlobjSearchColumn('custentity_reportingmanager');
similarly, I can get the RM of the RM by using
Copy code
new nlobjSearchColumn('custentity_reportingmanager', 'custentity_reportingmanager');
is it possible to get email of rm's rm? I know the below syntax is wrong, Just want to give an idea.
Copy code
new nlobjSearchColumn('email','custentity_reportingmanager', 'custentity_reportingmanager');
m
No. Unfortunately one of the limitations of saved searches is you can only access one level of joins. You can sometimes get around this by designing your search to work on the "middle" record and join in each direction. I'd advise looking at the query module and SuiteQL which support multiple levels of joins
r
thanks. I guess the only possible way to do that now is get the id of RM of RM with the search. and then either use nlapiLoadRecord or nlapiLookupField to get the email.
m
If there are multiple employees you don't want to do a separate lookup for each one. You will quickly run out of governance like that. What you can do is use the results of the first search as a filter in a second search to get all RMs of RMs in a single search, and then join the two search results in code.
b
add a new field to the employee that uses sourcing to source the email of the reporting manager
get that field instead of the
custentity_reportingmanager