This is the example code for a PostFunction to transition a linked Issue in status X to another status of the workflow. Very easy with Adaptavist Scriptrunner. See this code.
The best way is using @Grab to download in Runtime the LDAP library from Apache.org servers. More info about the class