I am trying to generate a rocketchat message to notify users about particular issues. I am using issue.getIssueType() and i expect to see something like Issue Type = "Story", "Bug" etc. However in the script i am using i get the following output:
"IssueConstantImpl[[GenericEntity:IssueType][sequence,null][name,Story][iconurl,/images/icons/issuetypes/story.svg][description,Created by Jira Software - do not edit or delete. Issue type for a user story.][style,null][id,10001][avatar,null]] "
i have tried several variations of getIssueType()getIssueTypeObject() etc and can not find the one i am looking for. Please help!!
Using = Jira v8.0.2, Scriptrunner v5.9.1
here is the code:
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import com.atlassian.jira.issue.Issue
import util.RocketChatAPIUtil;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager;
def sponsorFieldId = "customfield_10805";
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField= customFieldManager.getCustomFieldObjectByName("Sponsor")
// the issue provided to us in the binding
Issue issue = issue
// get sponsor name
String sponsorName = issue.getCustomFieldValue(customField).toString();
String sponsorName2= sponsorName.split("\\(")[0];
def test1 = new RocketChatAPIUtil();
//Send message
test1.sendMessageToChannel("inactiveuser","ALERT, " + issue.getKey() + " "+ issue.getIssueType() + " " + issue.getSummary() + " " + sponsorName2 + " - requestor is inactive please let me know if you still need this request ." )
Hi @LIndsay Kiefer ,
I believe, this should work:
issue.getIssueType().getName()
When you try to log:
log.error(issue.getIssueType().getName())
How does the output look like?
Thank you.
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.