• Mac D Greene
  • NEWBIE
  • 0 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
This is my second attempt at trying to deploy this Jira Connector Apex to Production. I have fixed many other errors but these are outside my scope.The first attempt had 23 issues. I have attempted to reach out to Service Rocket support but have had no response.


User-added image
CreateIssueTest - The error is with the last line of code. Cant figure out what it needs to be to pass??
@isTest public class CreateIssueTest implements HttpCalloutMock {
private static HttpRequest request;
private static HttpResponse response;

public HTTPResponse respond(HTTPRequest req) {
    request = req;
    response = new HttpResponse();
    response.setStatusCode(200);
    return response;
}

@isTest static void createIssueTriggerTest() {
    Test.setMock(HttpCalloutMock.class, new CreateIssueTest());
    Case case1 = new Case();

    Test.startTest();
    insert case1;
    Test.stopTest();

    System.assertEquals(JIRA.baseUrl + '/rest/customware/connector/1.0/' + JIRA.systemId + '/Case/' + case1.id + '/issue/create.json', request.getEndpoint());
}
}


 
I am trying to alter the code provided by Service Rocket. We need the trigger to fire when the approval process tied to Custom_Dev__C is approved. I have little experience with writing Apex or any code. I understand that it’s creating the Jira issue when a new case is created.
 
  1. Compare in Trigger and have this in IF Condition whether [Approved__c == True]
    1. Approved__c is a checkbox that is subject to a field update after going through the approval process.
Could someone please help me make the necessary changes to get this working? Or explain where to insert the code to make it work.
trigger CreateIssue on Custom_Dev__C (before insert) {
// Check whether current user is not JIRA agent so that we don't create an infinite loop.
  if (JIRA.currentUserIsNotJiraAgent()) {
    for (Custom_Dev__C c : Trigger.new) {
      // Define parameters to be used in calling Apex Class
      String objectType =  ‘Custom_Dev__C’; // Please change this according to the object type
      String objectId = c.id;
      String projectKey = 'CustomDev'; //Please change this according to the JIRA project key
      String issueType = '10';   //Please change this according to the JIRA issue type ID
      // Calls the actual callout to create the JIRA issue.
      JIRAConnectorWebserviceCalloutCreate.createIssue(JIRA.baseUrl, JIRA.systemId, objectType, objectId, projectKey, issueType);
    }
  }
   
}
 
 
This is my second attempt at trying to deploy this Jira Connector Apex to Production. I have fixed many other errors but these are outside my scope.The first attempt had 23 issues. I have attempted to reach out to Service Rocket support but have had no response.


User-added image
CreateIssueTest - The error is with the last line of code. Cant figure out what it needs to be to pass??
@isTest public class CreateIssueTest implements HttpCalloutMock {
private static HttpRequest request;
private static HttpResponse response;

public HTTPResponse respond(HTTPRequest req) {
    request = req;
    response = new HttpResponse();
    response.setStatusCode(200);
    return response;
}

@isTest static void createIssueTriggerTest() {
    Test.setMock(HttpCalloutMock.class, new CreateIssueTest());
    Case case1 = new Case();

    Test.startTest();
    insert case1;
    Test.stopTest();

    System.assertEquals(JIRA.baseUrl + '/rest/customware/connector/1.0/' + JIRA.systemId + '/Case/' + case1.id + '/issue/create.json', request.getEndpoint());
}
}


 
I am trying to alter the code provided by Service Rocket. We need the trigger to fire when the approval process tied to Custom_Dev__C is approved. I have little experience with writing Apex or any code. I understand that it’s creating the Jira issue when a new case is created.
 
  1. Compare in Trigger and have this in IF Condition whether [Approved__c == True]
    1. Approved__c is a checkbox that is subject to a field update after going through the approval process.
Could someone please help me make the necessary changes to get this working? Or explain where to insert the code to make it work.
trigger CreateIssue on Custom_Dev__C (before insert) {
// Check whether current user is not JIRA agent so that we don't create an infinite loop.
  if (JIRA.currentUserIsNotJiraAgent()) {
    for (Custom_Dev__C c : Trigger.new) {
      // Define parameters to be used in calling Apex Class
      String objectType =  ‘Custom_Dev__C’; // Please change this according to the object type
      String objectId = c.id;
      String projectKey = 'CustomDev'; //Please change this according to the JIRA project key
      String issueType = '10';   //Please change this according to the JIRA issue type ID
      // Calls the actual callout to create the JIRA issue.
      JIRAConnectorWebserviceCalloutCreate.createIssue(JIRA.baseUrl, JIRA.systemId, objectType, objectId, projectKey, issueType);
    }
  }
   
}