1
0
-1

Question by Kevin Ketchum:

I am getting this error in the sync attempt while trying to sync the Epic Status value:
Field Specify a valid 'id' or 'name' for Epic Status: customfield_10012.
This is my setting on the incoming script - as you can see, I'm setting it to a specific value:
issue.customFields."Epic Status".value = "To Do"

Jira Server Outgoing:

replica.customFields."Epic Status" = issue.customFields."10003"  //Epic Status (gh-epic-label)

Jira Cloud Incoming:

def epicstatusMap = ["10000":"10016", "10001":"10017", "10002":"10018"] //To Do In Progress, Done
	def epicstatusIncomingID = replica.customFields."Epic Status".value.value
/*
  	def epicstatusId = epicstatusMap[epicstatusIncomingID]
    if (epicstatusId == null) {
      throw new com.exalate.api.exception.IssueTrackerException("No Epic Status mapping for incoming Epic Status value(s) " + epicstatusIncomingID)
    }
    */
issue.customFields."Epic Status".value = "To Do"
  1. Daniel Carvajal

    Hi 

    From the line:

    replica.customFields."Epic Status" = issue.customFields."10003"

    Could you verify that the custom field Id "10003" is the correct one for the Epic Status field, usually 10003 is used for Epic Name.

    Kind regards,

    Daniel

  2. Kevin Ketchum

    I have confirmed in our system, the Epic Status internal ID is 10003.

    In case this helps, the replica data from our system (when looking at the error in the cloud instance) shows this for the Epic Status field:

    "10003": {
            "id": 10003,
            "name": "Epic Status",
            "uid": "10003",
            "description": "Epic Status field for Jira Software use only.",
            "type": "OPTION",
            "value": {
              "id": "10002",
              "sequence": 2,
              "value": "Done",
              "disabled": false,
              "childOptions": []
            }
          },
  3. Kevin Ketchum

    Another observation:

    When I use this to attempt update the Epic Status field:


    I get this in the stack trace.

    Using Postman, when I use this JSON to attempt to update the field, I get the exact same error

    (the top is the JSON I use in the PUT, and the bottom is the results)



    However, when I use this JSON format, the field is updated correctly:


CommentAdd your comment...

2 answers

  1.  
    1
    0
    -1

    I believe I have this under control.


    my sync is configured as such (basically):

    if (issuetype == "bug") {
       ... update bug specific fields
    } else if (issuetype == "epic") {
        ... update epic specific fields
        def epicStatusValue = replica.customFields."Epic Status".value.value
        issue.customFields."Epic Status".value = nodeHelper.getOption(issue, "Epic Status", epicStatusValue)
    } else if (issuetype == "story") {
        ... update story specific fields
    } else if (issuetype == "task") {
        ... update task specific fields
    }
    Epic.receive()

    Then, per the exalate documentation, I added Epic.receive() to the end if the imcoming sync

    (see this documentation:  https://docs.idalko.com/exalate/display/ED/How+to+sync+epics+in+Jira+Cloud)


    When I do that, I get the error initially reported.

    So, I have adjusted the sync config as follows:

    if (issuetype == "bug") {
       ... update bug specific fields
       Epic.receive()
    } else if (issuetype == "epic") {
        ... update epic specific fields
        def epicStatusValue = replica.customFields."Epic Status".value.value
        issue.customFields."Epic Status".value = nodeHelper.getOption(issue, "Epic Status", epicStatusValue)
    } else if (issuetype == "story") {
        ... update story specific fields
        Epic.receive()
    } else if (issuetype == "task") {
        ... update task specific fields
        Epic.receive()
    }
    
    

    Notice the Epic.receive() code is at the end of the incoming sync (per the documention), but it is now inside all code sections EXCEPT the epic section, instead of at the end of all code.


    So far, this seems to work.


    I'll update it as I see more or less success.

    1. Francis Martens (Exalate)

      Ah - thanks for the hint.  We're reviewing the external script and will take this into account

    CommentAdd your comment...
  2.  
    1
    0
    -1

    Kevin Ketchum 


    I reproduced the problem as follows


    • Setup a local connection
    • Add following code to the connection



      if (firstSync) {
      ...
          if (issue.typeName == "Epic") {
              issue.customFields."Epic Name".value = "Hello"
              issue.customFields."Epic Status".value = "To Do"        
          }
      }
      
      


    • Trigger an exalate
    • See that it fails with the failure



    Then adapt the code to

    if (firstSync) {
    ...
        if (issue.typeName == "Epic") {
            issue.customFields."Epic Name".value = "Hello"
            issue.customFields."Epic Status".value = 
    					nodeHelper.getOption(issue, "Epic Status", "To Do")        
        }
    }
    
    



    And now it works.



    Give it a try

    1. Kevin Ketchum

      I'll try it out - but first I have a question.

      You are using the qualifier

      if (firstSync) {

      }

      What happens if this is not the first sync but, instead, is an update?


      What is the actual affect of using (or not using) the firstSync qualifier ?

    2. Francis Martens (Exalate)

      That is completely fine. 

    3. Kevin Ketchum

      It looks like the Epic Status was settable during initial issue creation.

      However, whenever I use this code:

            issue.customFields."Epic Status".value = nodeHelper.getOption(issue, "Epic Status", "To Do")    

      to update the issue (specifically, change the Epic Status), I get the same error:

            Could not update issue `10,034`: Field customfield_10012: Specify a valid 'id' or 'name' for Epic Status. 

    CommentAdd your comment...