Item Maintenance Tab Orders Count

SOLVED

Hello, 

I am trying to come up with a counter for the number of orders (Standard or Backorders) that an item is on. So far I have tried a script that counts the line inside of SO_SalesOrderDetail but it won't write to the two UDFs made in CI_ITEM. Has anyone come up with something like this before? I just need two fields in the item maintenance screen to show how many Standard or backorders that certain item is on.