Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Set up Jira fields in my Apex integration program?

Aruhi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 26, 2020

I am facing an issue while integrating Apex program with Jira, Unable to set the specific Jira fields in it. My code looks like the following;

String jsonContent = res.getBody();
                        System.debug(jsonContent);
                        JSONParser parserJira = JSON.createParser(jsonContent);
                        while (parserJira.nextToken() != null) {
                            if (parserJira.getCurrentToken() == JSONToken.START_ARRAY) {
                                while (parserJira.nextToken() != null) {
                                    JiraIssue jIssue = (JiraIssue)parserJira.readValueAs(JiraIssue.class);
                                    if(c.CaseNumber.equals(jIssue.SFDCCaseNumber)){
                                    	c.Bug_Number__c = jIssue.BugNumber;
                                        casesToUpdate.add(c);
                                        //Mapping
                                       	String Description = parserJira.Description;
                                        String Title = JSONContent.Title;
                                        String SFDCCaseNumber = JSONContent.SFDC_Case_Number__c;
                                        String BugNum = JSONContent.Issue_Number;
                                        
                                        Title = c.Subject;
                                        SFDCCaseNumber = c.CaseNumber;
                                        Description = c.Description;
                                        c.Bug_Number__c = BugNum;
                                    }
                                }
                            }
                        }
This is not the full length code, and it parses JSON. Anybody can look into this issue, it would be a great help to complete my Salesforce Apex project ontime.

 

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2020

What errors do you get back when you try to post this?

Aruhi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 27, 2020

 I'm having a little trouble figuring out how to reference/set the specific Jira issue fields. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2020

I'm having trouble reading your code, I can't see quite what it is building and sending to Jira to reference it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events