I have a custom option set on an Opportunity form and one of the option (last) is hidden. I've have a ribbon button & on click of that button I need to show and select that option. It's working fine for the first time but my problem is if I click on that button for 2nd or 3rd time and so on it's duplicating/adding the same text part of that option to that option set...Option Set
You can avoid manually checking for the option by simply call ctrl.removeOption(1234)
before calling ctrl.addOption(1234)
.