I need to automatically close issues in state open after 30 days. The transition is a no-brainer and works fine combined with the CRON expression. What does not work is the update of the two customfields. "RCP Request Resolution" is a "Select list, Single choice" field and "RCP Resolution Comment" a "Multi Line, Free text). Here is the code I wrote which does not create any error logs:
import com.atlassian.jira.component.ComponentAccessor
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("RCP Request Resolution") def cfConfig = cf.getRelevantConfig(issue)
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {it.toString() == 'Dropped'} issue.setCustomFieldValue(cf, value)
def cf1 = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'RCP Resolution Comment'}
issueInputParameters.addCustomFieldValue(cf1.id, "Dropped due to inactivity")
We are using JIRA 6.3.15 and Scriptrunner 3.0.16.
Thank you in advance for your assistance.
Community moderators have prevented the ability to post new answers.
It's the same as this: https://answers.atlassian.com/questions/31657109 (not to mention https://jamieechlin.atlassian.net/browse/GRV-817)
First get the Option object corresponding to RCP Resolution Comment, then set that.
Thank you for your response.
I copied the code from the first link provided. So the only difference I have found is in the line "def cfConfig...". I changed from "cf." to "selectCf." and got this error code:
No such property: selectCf for class: Script164
Code looks like this now:
import com.atlassian.jira.component.ComponentAccessor def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("RCP Request Resolution") def cfConfig = selectCf.getRelevantConfig(issue) def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {it.toString() == 'Dropped'} issue.setCustomFieldValue(cf, value) def cf1 = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'RCP Resolution Comment'} issueInputParameters.addCustomFieldValue(cf1.id, "Dropped due to inactivity")
Sorry, I am new to Scriptrunner.... Trying to get better in it :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This bit of code is not working under the escalation service in built-in scripts but with the post-function it does... So escalation-service is pushing the issue from open to closed and the post function is adding the values to the fields. import com.atlassian.jira.component.ComponentAccessor def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("RCP Request esolution") def cfConfig = cf.getRelevantConfig(issue) def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {it.toString() == 'Dropped'} issue.setCustomFieldValue(cf, value) def cf1 = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("RCP Resolution Comment") issue.setCustomFieldValue(cf1, "Dropped due to inactivity") Thanks again for your help.
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.