Inquiring into if the getLocation() API is referring to the physical location specified in the employee record or if this refers to the address in the employee record (List > Employees > Address subtab)?
Whenever trying to invoke getLocation() API it is giving 0 (numeric value).
Sample code:
var context = nlapiGetContext();
var loc = context.getLocation(); // API in question
var sub = context.getSubsidiary();
var compv = context.getCompany();
nlapiLogExecution('DEBUG','loc',loc);
nlapiLogExecution('DEBUG','sub',sub);
nlapiLogExecution('DEBUG','company',compv);
The above sample code should work but the UI should be set accordingly. Complete steps are below on how to correctly setup an SIC and non-SIC account to make getLocation() to work.
SIC / One World Account:
- Setup > Company > Enable Features > Company > Classifications > Locations > This should be enabled to the account
- Setup > Company > Locations > There should be locations defined in this section
- List > Employees > Edit the employee in question where getLocation() should be executed > Info subtab > Subsidiary and Location fields should be populated.
Note: This is where the user may fail to associate a record to a location. If this is not explicitly set, it would return 0 even if the account has locations defined under Setup > Company > Locations.
Non - SIC / Regular Account:
- Setup > Company > Enable Features > Company > Classifications > Locations > This should be enabled to the account
- Setup > Company > Locations > There should be locations defined in this section
- List > Employees > Edit the employee in question where getLocation() should be executed > Info subtab > Location field should be populated.
Note: This is where the user may fail to associate a record to a location. If this is not explicitly set, it would return 0 even if the account has locations defined under Setup > Company > Locations.
No comments:
Post a Comment