+ Start a Discussion
Michael RotterMichael Rotter 

Referencing/setting Jira fields in my Apex integration code

I am writing an SFDC - Jira integration in Apex and I'm having a little trouble figuring out how to reference/set the specific Jira issue fields. My current attempt looks like this:
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 snippet only shows the part of the code that parses the JSON response from Jira and my attempt at the mapping, and I would really like to hear what everyone on here thinks about referencing and setting those Jira fields to the value of the SFDC case fields. Thanks!