Hello
Is it possible to accessProfields plugin's values through ScriptRunner?
For.e.g. I'd like to get profields values from custom REST endpoint.
When I am importing profields classes, it shows me an error
"Unable to resolve class com.deiser.jira........" (see attached screenshot)
Thank you in advance!
Fyodor
Hi Fyodor,
It's a pleasure to hear from you again :)
You can find the solution in this post: https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.html
In this case, the code gets the value of the status field in a project:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.deiser.jira.profields.api.field.FieldService
import com.deiser.jira.profields.api.value.ValueService
import com.deiser.jira.profields.api.field.status.StatusField
import com.atlassian.jira.issue.Issue
@WithPlugin("com.deiser.jira.profields")
Issue issue = ComponentAccessor.issueManager.getIssueByCurrentKey("SCRUM-7")
def valueService = ComponentAccessor.getOSGiComponentInstanceOfType(ValueService.class)
def fieldService = ComponentAccessor.getOSGiComponentInstanceOfType(FieldService.class)
def statusField = fieldService.get(9) //ID of field Status
return valueService.getValue(issue.projectObject,(StatusField) statusField)
You can find all the API info of versión 5.5.4: http://profields.javadoc.deiser.com/5.5.4/
Regards,
Adrián.
Hello Adrian
Thank you for advice.
Fyodor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adrian,
I am using prifields api in one of my custom JIRA plugin.
I have implemented in a similar fashion as per your post bet getting below Error.
valueService.getValue(issue.projectObject,(StatusField) statusField)
Error Log :
java.lang.ClassNotFoundException:com.deiser.jira.profields.api.field.status.StatusField
not found by com.org.jira.plugin.synch-onejira-plugin [276]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.org.jira.plugin.ojira.wf.postfunction.SetChannelFieldPostfunction.calculateChannelFieldValue(SetChannelFieldPostfunction.java:138)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kiranped,
Can you update Profields plugin to the last version and do the same test?
Cheers,
Adrián.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried with 5.6.3 version and JIRA 7.6 version. I am facing the same problem.
Profield Type: Select List (single choice)
I am using ListField
private Field getPartnerVisibleProField(){
List<Field> fields = fieldService.get();
for (Field field : fields){
if ("Field_Name".equals(field.getName())){
return field;
}
return null;
}
valueService.getValue(issue.projectObject,(ListField) getPartnerVisibleProField()) //
java.lang.NullPointerException
*********************************StatusField case******************************
if I typecast to (StatusField)getPartnerVisibleProField(), getting null object but I have a value updated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Muy buenas Adrian,
Estoy evaluando el plugin y necesito saber si puedo cambiar un campo de tipo status en una postfuntion de script runner.
Por ejemplo:
Al ejecutar un bloqueo de una tarea que el campo status del proyecto cambie a bloqueado. ¿tienes un ejemplo para orientarme?
Un saludo.
I am evaluating the plugin and I need to know if I can change a field of type status in a postfuntion of script runner. For example: When executing a block of a task, the status field of the project changes to blocked. Do you have an example to guide me? A greeting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Yes, you need to add @WithPlugin("com.deiser.jira.profields") command, then you can use profields methods and classes.
See related issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, I have done this through REST End Point and it is working. But while I am executing same script via custom script applied on post function of the jira workflow. It shows the error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.