Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

Is it possible to sync "Database Picker Custom Field" from Scriptrunner?

 
1
0
-1

I wonder if it is possible to sync Database Picker Custom Field (multiple options)?


I tried with this but I get an exception:


Source Instance (Outgoing Sync):

String productTypeCFName = "Product Type"
def productTypeCF = customFieldManager.getCustomFieldObject(issue.customFields[productTypeCFName].id)
def productTypeCFT = productTypeCF.getCustomFieldType()
replica.customKeys[productTypeCFName] = productTypeCFT.getStringFromSingularObject(issue.customFields[productTypeCFName]?.value)

Target Instance (Incoming Sync):

({
def syncDbField =

{ String remoteCfName, String cfName-> def cfm = com.atlassian .jira.component.ComponentAccessor.getCustomFieldManager() def cf = cfm.getCustomFieldObject(issue.customFields[cfName].id) def cft = cf.getCustomFieldType() issue.customFields[cfName].value = cft.getSingularObjectFromString(replica.customKeys[remoteCfName]) }

syncDbField("Product Type", "Product Type")
})()



I get this as exception: java.util.ArrayList cannot be cast to java.lang.String
On this line:
replica.customKeys[productTypeCFName] = productTypeCFT.getStringFromSingularObject(issue.customFields[productTypeCFName]?.value)

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hello David Henriksson ,


      Could you please give more details on your question?

      • Why are you using Database Picker Custom Field (DPCF) value search instead of passing the existing "static" value from the issue?
      • Does your DPCF is using the same DB as your Jira instance?
      • If not: Does your DPCF's on the both Jira instances use the same DB?
        CommentAdd your comment...