Script error details: Ambiguous method overloading for method

Originally asked by last knight on 01 April 2020 (original question)


I have two JIRA server instances, and when I try to sync I got below: Script error details: Ambiguous method overloading for method It was working before, not sure at which point it starts breaking, I added recently:

issue.customFields."Acceptance Criteria".value = replica.customFields."Acceptance Criteria".value

Below is the rule on the receiving systems: ===========

if(firstSync){ // If it's the first sync for an issue (local issue does not exist yet)
	issue.projectKey = replica.customFields."Vendor Name"?.value?.value 
	// Set type name from source issue, if not found set a default 
	issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name 
} 
issue.summary = replica.summary 
issue.description = replica.description 

Source: Jira Server/Datacenter


Answer by Juan Grases on 03 April 2020

Hi!

The problem here is on line:

issue.projectKey = replica.customFields."Vendor Name"?.value?.value 
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name 

nodeHelper.getIssueType is failing when the second parameter is null. In this case is null because the value of the remote custom field “Vendor Name” is empty (or it was not properly set from the sending side).

You can work around this by doing something like:

def vendorName = replica.customFields."Vendor Name"?.value?.value 
if(vendorName == null)return; //This will cancel the sync if you are not receiving a value on vendor name
issue.projectKey = vendorName
issue.typeName = replica.typeName

There is actually no need to use the nodeHelper to get the issue type name, if you know that the receiving type also exists in your system.

Best regards,

Juan


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