I know this is a really old thread, but I was working on this issue the other day, so I thought I would share my understanding of how this works...
I think by the time RMS calls the AddItemHook, it has already processed the input and attempted to lookup the SKU and filled the Transaction and TransactionEntry objects and moved the cursor to the next line item (hence the current key is empty). If you want to get the line item of the actual input, it's one line above. Here's the code I use to get the actual line item that was entered ...
----- Begin Code -----
int lineItemCount = this.RmsSession.Transaction.Entries.Count;
TransactionEntry lineItem = this.RmsSession.Transaction.Entries[lineItemCount];
string key = this.RmsSession.Transaction.get_CurrentEntryKey();
int prevKeyIndex = 0;
if (! String.IsNullOrEmpty(key)) // Key not empty
{
// Find the proper line item (one less than key match)
bool found = false;
for (int i=1; i<=lineItemCount; i++)
{
TransactionEntry li = this.RmsSession.Transaction.Entries[i];
if (String.Compare(li.Key, key) == 0)
{
found = true;
break;
}
prevKeyIndex = i;
}
if ((found) && (prevKeyIndex > 0))
lineItem = this.RmsSession.Transaction.Entries[prevKeyIndex];
}
----- End Code -----
DC