Skip to content

Polarion SDK

Polarion's SDK documents the available APIs, the embedded database schema, supported scripting languages and engines, libraries, source code, and code examples for developers who want to develop custom extensions to Polarion's standard features and functionality.

Tip

Need a custom script for Workflow Functions and Conditions?

The SDK content is installed to the file system along with all other programs and data.

Default SDK location

You can find Polarion's SDK content in the $POLARION_HOME$/polarion/sdk folder of your installation.

Documentation is located in the doc sub-folder.

The [POLARION_HOME]/polarion/sdk/index.html file provides links to all SDK resources. You can access the SDK index page via your web browser by appending polarion/sdk/ to the URL of your Polarion server.

Example

http://polarion.mydomain.com/polarion/sdk/

You can also copy the SDK from the installed location to local computers or host it on a file server.

FAQ

  1. Where can I go to get help with scripts and Polarion API?

    Answer: The best place to ask questions and get answers from other Polarion users and experts is on the Polarion Community website.

  2. Do we need to call .save() on the object (workflowContext.getTarget()) from which the workflow execute in a ScriptCondition?

    Answer: You should never call .save() on the object that executes the workflow in a ScriptCondition. (It is not a script type meant for modifying Polarion Data.)

  3. Do we need to call .save() on the object (workflowContext.getTarget()) from which the workflow execute in a ScriptFunction?

    Answer: You should never call the .save() on the object that executes the workflow in a ScriptFunction because the script is already executing when Polarion saves the base object. If your ScriptFunction modifies another object (for example, a Work Item linked to the current Work Item that the workflow executes on), then yes, .save() should be called on this other object.

  4. I have updated the Scheduler entry for my script.job but when I try to run it manually in the Monitor, it does not pick up my modifications.

    Answer: If you are updating the Scheduler Scheduler entry of your job, make sure to refresh the Monitor Monitor page to pick up the changes.

  5. My script.job is failing when executed automatically via the Scheduler but not when I run it manually.

    Answer: This means that the job does not have the same access to the Polarion data when it is executed automatically by the Scheduler Scheduler because it uses the polarion user. (That only has read-only access to the data.) To execute it successfully, you must use the doAsUser method. See the "Running parts of a script.job as another user with doAsUser" section in the SDK Scripting Guide for details.

  6. When executing a Groovy script an error is generated when trying to retrieve the current Groovy version.

    Answer: The error is due to the use of an unsupported getVersion() call, probably from a Groovy script that was written for v1.5.

    Example

    org.codehaus.groovy.runtime.InvokerHelper.getVersion();

    With Groovy 2.4.21, it should be written as:

    GroovySystem.getVersion();

  7. When executing a script.job, I am getting this type of error: Method (...) cannot be executed from a job script.

    Answer: Starting with Polarion 2304, some methods from com.polarion.platform.security.ISecurityService are being deactivated by default. You can unblock methods for script.job that are blocked by default by defining them in the following property in the polarion.properties file:

    com.polarion.scripting.job.allowedSecurityServiceMethods

    For example, if you want to unblock addGlobalRoleToUser() and addContextRoleToUser():

    com.polarion.scripting.job.allowedSecurityServiceMethods=addGlobalRoleToUser,addContextRoleToUser

    For more information on the property, consult the Polarion System Configuration Properties Reference guide on Support Center.

  8. When executing a ScriptFunction or ScriptCondition, I am getting this type of error: Method (...) cannot be executed from a script.

    Answer: Starting with Polarion 2304, some methods from com.polarion.platform.security.ISecurityService are being deactivated by default. You can unblock methods for ScriptFunction and ScriptCondition that are blocked by default by defining them in the following property in the polarion.properties file:

    com.polarion.scripting.allowedSecurityServiceMethods.

    For example, if you want to unblock addGlobalRoleToUser()and addContextRoleToUser():

    com.polarion.scripting.allowedSecurityServiceMethods=addGlobalRoleToUser,addContextRoleToUser

    For more information on the property, consult the Polarion System Configuration Properties Reference guide on Support Center.

Community

Connect and Collaborate with Industrial Professionals and Join the Community!

Click to load comments