The ability to allow 1 checkmark in all records in portal

Discussion created by ascii7x on May 29, 2013
Latest reply on May 31, 2013 by ascii7x

Hello, I have been busting my hump on how to script or find afunction that would allow me to let users only select one checkmark in the records in a portal.

In other words, we have a portal for our main clients, these clients have emergency contacts. Each emergency contact created creates a new record in the "phoneNumber" table. In the phonenumber table, there is a unique phonenumberID. In that same table, those numbers are associated with a contactID for theclient that provided these phone numbers. In each record, there is a check-box that our employees click on to mark it as a main number. In that same portal, any number(record) that is marked as "Main Number", it gets sorted to the top of the portal. This main number that gets selected gets placed in a field used for printing cards. The problem is that if this number is unchecked from 'main number' and a new number is checked as "main number", it will not display it. I would like to be able to only allow one one number in each portal to be "main number". If a main number is selected and there is one already that have been selected as "main number" I would like the user to get an error message letting them know only one is possible. The FM feature of custom diaglog does not allow me to create a script to run when a button is clicked so I created a separate window(layout) with my buttons and a script on each to allow it to change a variable in the other layout to allow the movement throught the logic of the code which has a loop to count records in the portal to keep track of record rows done.


I tried different code methods butdoes not work correctly. Before writing this request, I thought what if, there was a way to collect the phoneNUmberIDs for the specific ContactID and then go through each of the records in phonenumber table or portal and uncheck the "main number" on all records that were previously checked and the new number that was checked to get the checkmark.


Please help with this confusion.