1
0
-1

Hello, we have the script below in our Jira Incoming Sync from Salesforce. We’re attempting to pass the Name to the Defect ID from SF to Jira. We input the lines (9 and 10) to identify if the Issue has the custom fields, if so to input the Name within Defect ID in the Issue. However, though the values are within the Remote Replica, they are excluded in the Local Replica. Are we missing something?


def defaultUser = nodeHelper.getUserByEmail("jira.salesforce@XXXXXX.com")
if (firstSync) {
    issue.projectKey = replica.JiraProjectKey__c
    issue.typeName = "Bug"
    if (replica.JiraProjectKey__c == "CIHS") {
        // Set default Epic Link
        issue.parentId = '138089'
    }
    if (issue.customFields.containsKey("Defect ID")) {
        issue.customFields."Defect ID".value = replica.Name
    }
    issue.summary = replica.summary
    issue.description = nodeHelper.toMarkDownFromHtml(replica.description)
    issue.assignee = defaultUser  // set the assignee to a default user
    try {
        issue.customFields."Step To Reproduce".value = replica.StepsToReproduce__c
    }
    catch (Exception ex) {}
    try {
        issue.customFields."Database".value = replica.DatabaseText__c
    }
	catch (Exception ex) {}
	
    try {
        issue.customFields."Schema".value = replica.Schema__c
    }
	catch (Exception ex) {}
    try {
        issue.customFields."SharePlex Server".value = replica.ShareplexServer__c
    }
	catch (Exception ex) {}
    try {
        issue.customFields."Account Login".value = replica.AccountLogin__c
    }
	catch (Exception ex) {}
    try {
        issue.customFields."Soffront Category".value = replica.Category__c?.value ?: ""
    }
	catch (Exception ex) {}
    
    syncHelper.syncBackAfterProcessing()
}


def reporterUser = nodeHelper.getUserByEmail(replica.OwnerEmail__c) 
issue.reporter = reporterUser == null ? defaultUser : reporterUser
issue.environment = replica.EnvironmentText__c

if (issue.customFields.containsKey("Escalation")) {
    if (replica.IsEscalated__c) {
        issue.customFields."Escalation".value = ["Yes"]
    } else {
        issue.customFields."Escalation".value = ["No"]
    }
}
if (issue.customFields.containsKey("Escalation Reason")) {
    issue.customFields."Escalation Reason".value = replica.EscalationReason__c?.value ?: ""
}

if (issue.customFields.containsKey("Build Break")) {
    if (replica.IsPostRelease__c) {
        issue.customFields."Build Break".value = ["Yes"]
    } else {
        issue.customFields."Build Break".value = ["No"]
    }
}

issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)  


The record ID in the example is a7K5d0000027aB7EAI. The issue is syncing fine with all other values. The Defect ID is not reflecting the replica.Name as it should be in the script we provided.

Jira Incoming:
if (issue.customFields.containsKey("Defect ID")) {
issue.customFields."Defect ID".value = replica.Name

You'll see in the Remote Replica Script the Name is: "Name": "YYYY-XXXXXX". So, we're expecting the Issue CCCC-VVVV to show FFFF-RRRRR in Defect ID. However, it is blank in Jira.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Harold



      Please verify 

             issue.customFields."Defect ID".value = replica.Name


      that replica.Name contains a value at all. The Name is in no API reference documentation.

      Unless it is a customfield called Name, it would not contain any information.


      Thank you.

      Kind regards,
      Mathieu Lepoutre

        CommentAdd your comment...