Sunday, February 3, 2019

Determine the Liability Account's Account Number of a Payroll Item


On a Payroll Item search, the Liability Account is returned as a text field; it contains both the account number and account name. This sample snippet demonstrates how you can retrieve the account number via scripting:

   var account = nlapiLoadRecord('account', 12345);
   var acctnumber = account.getFieldValue('acctnumber');


EXPLANATION:
   It is not explained in the article what are the results of customsearch91 (Saved Search) are. nlapiLoadRecord fails when loading built-in Accounts (negative internal IDs), giving a RCRD_DSNT_EXIST error.

   Consider adding disclaimer that this only works on custom Payroll Items  

No comments:

Post a Comment