Hello, Im running my Jira to DevOps automation through a trigger in Jira. This created a DevOps ticket and populates different things to it.
I have a custom field called Jira (which is referece as Custom.JIRA ) which i try to populate and it does not work.
DevOps Incoming never find that field. I tried through FirstSync and outside first sync and the result is the same, it cant find the field.
this is my script
if (workItem.customFields[“Custom.JIRA”] != null) {
workItem.customFields[“Custom.JIRA”].value = jiraInfo
store(workItem)
}
any ideas why the custom field is not showing up, even if it leave it outside of first sync and then do an update on the jira ticket, it doesnt update that, it updates the description so i know the connection is working.
Hi @Lautaro
Can you please try to add this script at the end of the incoming sync script:
//for first sync
if(firstSync){
store()
workItem.customFields.“Remote ID”.value=issueUrl
}
workItem.customFields.“Remote ID”.value=issueUrl
Thanks,
Sonal
When i try to use that, it errors out saying
Cannot set property ‘value’ on null object
Im guessing this is due to issueUrl being empty, since its not picking it up in either side.
Hi @Lautaro
Can you please share your incoming sync script of ADO?
Thanks,
Sonal
// CODE
if (firstSync) {
workItem.projectKey = replica.customFields.“DevOpsProject”?.value?.value ?: “DEFAULT_PROJECT”
workItem.typeName = “User Story”
workItem.summary = replica.summary
syncHelper.syncBackAfterProcessing()
}
workItem.attachments = replica.attachments
//workItem.description = replica.description
// Prepend JIRA info to description
def jiraUrl = “https://xxxxxx.atlassian.net/browse/${replica.key}”
def jiraInfo = “JIRA TICKET → ${jiraUrl}” // 4 newlines after the link
//def plainDescription = nodeHelper.stripHtml(replica.description ?: “”)
workItem.description = jiraInfo + “\n\n\n” + replica.description
//replicate the link after the first sync
if (workItem.customFields[“Custom.JIRA”] != null) {
workItem.customFields[“Custom.JIRA”].value = jiraInfo
store(workItem)
}
Can you try this script?
if (firstSync) {
workItem.projectKey = replica.customFields.“DevOpsProject”?.value?.value ?: “DEFAULT_PROJECT”
workItem.typeName = “User Story”
workItem.summary = replica.summary
syncHelper.syncBackAfterProcessing()
}
workItem.attachments = replica.attachments
def jiraUrl = “[https://xxxxxx.atlassian.net/browse/${replica.key}](https://xxxxxx.atlassian.net/browse/$%7Breplica.key%7D)”
def jiraInfo = “JIRA TICKET → ${jiraUrl}” // 4 newlines after the link
//def plainDescription = nodeHelper.stripHtml(replica.description ?: “”)
workItem.description = jiraInfo + “\n\n\n” + replica.description
if (firstSync) {
store()
workItem.customFields.“ Custom.JIRA”.value = issueUrl
}
else {
workItem.customFields.“Custom.JIRA”.value = issueUrl
}