I want to map the JIRA Team Field to a Salesforce Case Picklist Field

I have the fields mapped but am stuck at how to Define the mapping between these fields so it is bi directional. I feel like I need a DEF script and then does it map to the Team Name or the OPTION ID in JIRA ? Screenshots included of the field. TEAM is a default field in JIRA and Team is a custom pick list field in SFDC


SFDC Outgoing
if(entity.entityType == “Case”) {
replica.key = entity.Id
replica.summary = entity.Jira_Title__c
replica.description = entity.Jira_Summary__c
replica.comments = entity.comments
replica.attachments = entity.attachments
replica.Jira_Account__c = entity.Jira_Account__c
replica.Jira_Pod__c = entity.Jira_Pod__c
}

SFDC Incoming
if(firstSync){
entity.entityType = “Case”
}

if(entity.entityType == “Case”){
entity.comments = commentHelper.mergeComments(entity, replica)
entity.attachments = attachmentHelper.mergeAttachments(entity, replica)
entity.Jira_Eng_Priority__c = replica.priority?.name
entity.Jira_ID__c = replica.key
entity.Jira_Status__c =replica.status?.name
entity.Jira_Pod__c = replica.Jira_Pod__c
}

JIRA Outgoing
replica.key = issue.key
replica.comments = issue.comments
replica.attachments = issue.attachments
replica.priority = issue.priority
replica.status = issue.status
replica.“Jira_Pod__C” = issue.Team

JIRA Incoming
if (firstSync) {
issue.projectKey = “ST”
// Set the same issue type as the source issue. If not found, set a default.
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: “Content Issue”
}

issue.summary = replica.summary
issue.description = nodeHelper.toMarkDownFromHtml(replica.description)
issue.comments = nodeHelper.toMarkDownComments(commentHelper.mergeComments(issue, replica))
issue.attachments = attachmentHelper.mergeAttachments(issue, replica)
issue.customFields.“Client Impacted”.value = nodeHelper.createOption(issue, “Client Impacted”, replica.“Jira_Account__c”)
issue.labels += nodeHelper.getLabel(“SFDCTechSupport”)
issue.Team = replica.“Jira_Pod__C”

I have the sync working from SFDC >>> JIRA and created a field DEF logic in Incoming Scripts using the Team ID #, however if I change the TEAM in JIRA it does not write back to SFDC here is the SFDC Incoming with updated script

def stageMap = [
“74ec6d9a-4c27-4936-930c-888d06f7ca34” : “Agent Pod”,
“5b92cdc6-5f1c-4c33-931d-9488b7fb4d71”: “Air Pod”,
“8c85caf6-3676-4596-865c-87d386a77c5a” : “API Pod”,
“36b5b727-366f-4c32-af4d-0209013efd99” : “Automation Pod”,
“f3187463-9455-4360-ae4d-2f9d4e9b6149” : “Back Office Pod”,
“a8305d2b-6ef2-4697-bb31-daa36ccffdd7” : “Content and Global POS”,
“ab701780-e892-4701-8a2a-456f1e77f18c” : “Data & Analytics Pod”,
“41c0de82-fe59-4b55-b081-5eab94276d45” : “Design Pod”,
“128562c0-5c0c-422d-ac13-ddf611b24fdd” : “FE Infra & Partner Pod”,
“62ca8d12-bdd4-4562-91cc-80ca11795517” : “Finance Team”,
“8d1b852b-e2a5-42b3-8a0a-58d44430e646” : “Guest & Event Pod”,
“3847d294-ee10-4963-b923-9fa3099799db” : “Hotel & Ground Pod”,
“5a7968b7-909e-421d-95e3-36d6f54db311” : “IGT / TE Support”,
“9c36ad9d-524b-4eec-961c-eda1b82661ce” : “P&P DevOps + SRE Pod”,
“86197f74-c7b4-4803-bf6a-2a0f1deb5798” : “PerfEng + Tools Pod”,
“cf9fa392-db0c-49b6-98d8-68752e685961” : “Platform Pod”,
“ff55c9ed-1a70-456c-82f1-80c86f6e84c7” : “Profile & Admin Pod”,
“2290f8c1-d27d-4036-8553-dae0621b57d8” : “QA Pod”,
“99303ce4-f735-4985-aa15-36b89c25e991” : “Supplier Content Relations Team”,
“44439d53-7d18-4d76-9932-ca5d09ce2d65” : “Seat 1A”,
“715b5c36-7786-4cca-b7fd-f2bf8f0d9bd7” : “TMC Pod”,
“2bc156fc-6a32-4185-ba91-1bcf18fc6bb2” : “Unassigned Pod”,
]
entity.Jira_Pod__c = stageMap[replica.Jira_Pod__c?.name]

@Javier or @mathieu
is there any help I can get here I can see everything in remote replica but still if I change the value in JIRA it does not change in SFDC

This is still something I have not been able to figure out @mathieu or @Javier

Ahh so you see everything in the replica. Then it should work really.
Can you share the relevant part of the remote replica (Accessed from SF please)

That is correct I can See the remote, I have no errors on the sync, but the Picklist value does not change in SFDC @Majid

I think this is the line to blame:
entity.Jira_Pod__c = stageMap[replica.Jira_Pod__c?.name]

So, if you look at the replica, it is fine and replica.Jira_Pod__c?.name is Air Pod.
But in the stageMap there is no Air Pod on the left side. You seem to have mapped ids instead of names there (maybe). If that is the case, I would do:
entity.Jira_Pod__c = stageMap[replica.Jira_Pod__c?.id]

OR

change the stageMap to have names on the left side instead of ids (probably the best option).

Hope it makes sense!

Thanks
Majid

1 Like

will try both and see which works I thought the left side was Remote (jira team field works off ID) and the right side was Local

@Majid adding the .id has worked ! thank you!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.