How can I loop through a certain foreign key filed in a list view?
Hello, I have a list view of case notes and at the top of that view I have a button to add a new note. When the button is pressed it jumps to the bottom of the list view, the script sets the foreign key for the new note to be added, and the script then goes to the note field so that the user can then begin typing in the new note. The problem I'm having with this approach is that if the user clicks the show all button and then clicks the add new note button, there are several foreign keys in the list view and my script can not accurately set the foreign key to the new note. The way I'm trying to correct that is if the user clicks the add note button the script will:
- set a variable called $CaseName to the first foreign key in the list view
- set a vaiable $CaseFkCount equal to the total count of all of the foreign keys in the list view
- set $Counter variable equal to 1
- loop through each record in the list view and if a foreign key does not equal the $CaseName variable then pop up a custom dialog box telling the user that they must be in the context of only one case
- each time the loop is iterated, 1 is added to $Counter
- if the loop finishes without step 4 equaling true then proceed to set the foreing key for the new note and go to the note field
How Can I make this work?