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?
Download the SDK Scripting Guide.
Download Example Scripts.
Visit our Community Portal and ask our experts.
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¶
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.
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.)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.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 entry of your job, make sure to refresh the Monitor page to pick up the changes.
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 because it uses the
polarion
user. (That only has read-only access to the data.) To execute it successfully, you must use thedoAsUser
method. See the "Running parts of a script.job as another user with doAsUser" section in the SDK Scripting Guide for details.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();
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 forscript.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()
andaddContextRoleToUser()
:com.polarion.scripting.job.allowedSecurityServiceMethods=addGlobalRoleToUser,addContextRoleToUser
For more information on the property, consult the Polarion System Configuration Properties Reference guide on Support Center.
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()
andaddContextRoleToUser()
:com.polarion.scripting.allowedSecurityServiceMethods=addGlobalRoleToUser,addContextRoleToUser
For more information on the property, consult the Polarion System Configuration Properties Reference guide on Support Center.