I'm trying to map the jira case fields with salesforce case fields but i'm stucked at mapping fields

         deserializejirajson.ResponseIssues theresult1 = (deserializejirajson.ResponseIssues)JSON.deserialize(res.getBody(),  deserializejirajson.ResponseIssues.class);
   System.debug('Results == :' + theresult1 ); 

      List<Case> casesToUpsert = new List<Case>();        
      for(deserializejirajson d : theresult1){

            Case c = new Case(); 
            c.Priority = d.Priority;
            c.Status = d.status;
            c.Subject = d.summary;
            c.Origin = d.issue_type;



"here i get priority doesn't exist compile time error"

this is my deserialize class

global class deserializejirajson{

        public class ResponseIssues

            public List<Issues> issues;


        public class Issues
            public string expand;
            public string id;
            public string self;
            public string key;
            public Field fields;

        public class Field
            public String summary   ;
            public Priority priority;    
            public Status status;
            public String Issue_type;        

        public class Priority

            public String name;


        public class Status

            public string name;


  • ResponseIssues doesn't contain Priorities as a child, the deserializing class (which you might want to reformat the name to follow java class naming conventions) does. thresult1 is a ResponseIssue, so it doesn't have a Priority child. It is a grandchild. – zgc7009 Apr 10 '17 at 16:21
  • @zgc7009 priority has one child I.e "name field" – user43518 Apr 10 '17 at 16:26
  • Right, but ResponseIssues (d in your example) has a list of Issues, that contains a Field, that references a Priority. You can't just go directly from ResponseIssues to Priority without following the parent/child chain. – zgc7009 Apr 10 '17 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy