Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Update custom fields value

Hello,

I have migrated JIRA from 6.2 to the 7.3 version. I was using Jelly Services to update the values in my custom fields every 60 minutes from another DB.

I'm looking for a solution to replace those jelly services with another service but I don't find anything.

My goal is to have a script that will run every 60min and will pick up informations from my DB with SQL and add changes in my custom field directly in JIRA, without creating a new custom field.

Thank you in advance for your help.

1 answer

If you still need to do the update every 60min:

Thank you for your answer ! 

Yes I've tried databasecf add-on but I have to create new custom fields and I have to use absolutely the existing custom fields. 

I have Script runner add-on but I don't know how to translate the Jelly script code in groovy.

For example I have that jelly code:

(I'm totaly lost with the atlassian classes and methods)

<sql:query var="valuesToAdd">
<!--My select SQL Query-->
</sql:query>

<!--options activées mais n'existant pas dans la table de référence-->
<sql:query var="idOptionsToDisable">
<!--My select SQL Query-->
</sql:query>

<!--options désactivées mais existantes dans la table de référence-->
<sql:query var="idOptionsToEnable">
<!--My select SQL Query-->
</sql:query>


<core:new className="com.atlassian.jira.component.ComponentAccessor" var="componentAccessor"/>
<core:invoke on="${componentAccessor}" method="getCustomFieldManager" var="customFieldManager"/>

<core:invoke on="${customFieldManager}" method="getCustomFieldObject" var="customField">
<core:arg type="java.lang.Long" value="10163"/>
</core:invoke>

<core:invoke on="${customField}" method="getConfigurationSchemes" var="fieldConfigScheme"/>
<core:invoke on="${fieldConfigScheme[0]}" method="getOneAndOnlyConfig" var="fieldConfig"/>
<core:invoke on="${componentAccessor}" method="getOptionsManager" var="optionsManager"/>

<core:forEach items="${valuesToAdd.rowsByIndex}" var="row">
<core:invoke on="${optionsManager}" method="createOption">
<core:arg type="com.atlassian.jira.issue.fields.config.FieldConfigImpl" value="${fieldConfig}"/> <!--Field config-->
<core:arg type="java.lang.Long" value="${null}"/> <!--parent option id -->
<core:arg type="java.lang.Long" value="${null}"/> <!--sequence-->
<core:arg type="java.lang.String" value="${row[0]}"/><!--value-->
</core:invoke>
</core:forEach>

<core:forEach items="${idOptionsToDisable.rowsByIndex}" var="row">
<core:invoke on="${optionsManager}" method="findByOptionId" var="optionToDisable">
<core:arg type="java.lang.Long" value="${row[0]}"/>
</core:invoke>

<core:invoke on="${optionsManager}" method="disableOption">
<core:arg type="com.atlassian.jira.issue.customfields.option.Option" value="${optionToDisable}"/>
</core:invoke>

</core:forEach>

<core:forEach items="${idOptionsToEnable.rowsByIndex}" var="row">

<core:invoke on="${optionsManager}" method="findByOptionId" var="optionToEnable">
<core:arg type="java.lang.Long" value="${row[0]}"/>
</core:invoke>

<core:invoke on="${optionsManager}" method="enableOption">
<core:arg type="com.atlassian.jira.issue.customfields.option.Option" value="${optionToEnable}"/>
</core:invoke>

</core:forEach>


<core:invoke on="${optionsManager}" method="getOptions" var="options">
<core:arg type="com.atlassian.jira.issue.fields.config.FieldConfigImpl" value="${fieldConfig}"/>
</core:invoke>
<core:invoke on="${options}" method="sortOptionsByValue">
<core:arg type="com.atlassian.jira.issue.customfields.option.Option" value="${null}"/>
</core:invoke>

 

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you