HI,
So I have the below script (which i saw in the community) working in my regular/software jira but it's not working on my service desk portal. Any idea/help?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.AttachmentSystemField
import webwork.action.ActionContext
def attachmentFiles = ActionContext.request?.getParameterValues(AttachmentSystemField.FILETOCONVERT)
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_22112")
log.warn(customField)
def CFvalue = (String)issue.getCustomFieldValue(customField)
log.warn(CFvalue)
if(CFvalue == "Yes" && attachmentFiles.size() < 2) {
return false
}
else {
return true
}
Hi Joel:
One of the reasons why it may not work via the portal UI -
1) For the customfield the script is using - Does it available in your Request Type setup? + your JSM project's issue setup?
It will be great if you can share with us what is the error being throw.
Hope this helps.
Best, Joseph Chung Yin
Jira/JSM Functional Lead, Global Infrastructure Applications Team
Viasat Inc.
yes it does...by the way i modified the script and it's working now
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.issue.MutableIssue
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_22112")
def CFvalue = (String)issue.getCustomFieldValue(customField)
def issue2 = issue as MutableIssue
def newAttachmentNames = issue2.modifiedFields.get(IssueFieldConstants.ATTACHMENT)?.newValue as List
if(CFvalue == "Yes" && newAttachmentNames.size() < 2) {
return false
}
else {
return true
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sharing the updated code. Glad it is working for you now.
Didn't realize that you are using the script when the issue is being modified.
Best, Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.