1. Setup > Customization > Scripts > New > Client
2. Upload the script below and reference the function name (testOne) on the Field Changed Function
var poppin = nlapiGetCurrentLineItemIndex('addressbook');
3. Save and Deploy the Client Script
4. On the Script Deployment, set the following below.
-- Applies To: Customer
-- Audience > Roles = All Roles = T
Note: Clicking the "Add / Edit" button will always return the current number of items plus 1. As the button label states, it has two functions wherein updated / changed line items are saved and a new line item is selected at the end when clicked. So if you edit line item 2 on a list of 5 line items and hit the "Add / Edit" button, the changes will be saved to line item 2 but the alert will return 6.