Sunday, September 9, 2018

How to make a call to getLocation API in SS using SIC and non-SIC account

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:

  1. Setup > Company > Enable Features > Company > Classifications > Locations > This should be enabled to the account
  2. Setup > Company > Locations > There should be locations defined in this section
  3. 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:

  1. Setup > Company > Enable Features > Company > Classifications > Locations > This should be enabled to the account
  2. Setup > Company > Locations > There should be locations defined in this section
  3. 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