Given the Name as the search filter, you can get the internal Id of a sub-department, sub-class and sub-location. There will be some instances where you will be requiring your user to enter Name of Departments/Locations/Classes and you have to retrieve their internal Ids. You may use 'name' as your search filter but you would not be able to retrieve sub records. To be able to do so, you may use 'namenohierarchy' as the search filter.
You can do this through nlapiSearchRecord as shown below:
* DepartmentnlapiSearchRecord('department', null, new nlobjSearchFilter( 'namenohierarchy', null, 'is', nameofdepartment), new nlobjSearchColumn('internalid'));
* Class
nlapiSearchRecord('classification', null, new nlobjSearchFilter( 'namenohierarchy', null, 'is', nameofclass), new nlobjSearchColumn('internalid'));
nlapiSearchRecord('location', null, new nlobjSearchFilter( 'namenohierarchy', null, 'is', nameoflocation), new nlobjSearchColumn('internalid'));
Note that it will return the internal Id of Departments/Locations/Classes and their sub records if the name entered matches the exact Name of the records from Setup > Company > Classifications.
No comments:
Post a Comment