I need a way to set “Scan Organization Triggers” via the Jenkins script console. This is close, but only shows Multibranch or Organization Scan triggers if they already exist:
https://github.com/cloudbees/jenkins-scripts/blob/master/setOrgFolderIndex.groovy
Here's a script that I made that detects multibranch or organization triggers. If the project doesn't already have one, it will create a trigger. Note: the addTrigger part is commented out, so this should be safe to run as-is.