Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JIRA REST API for Blank Cascading select list ID from ConfiForm input

We have a Select List (Cascading) custom field that contains the Divisions and Subdivisions that employees could work for. A while ago I got the input for the field working in my ConfiForm but I think the barbaric way I did it is breaking the ability for it to "update" and link my issues.

Searching how to input the ID's, i found the syntax

    {"id":"11111", "child":{"id":"22222"}}

So I set up a form with the ID's and set up a smart classifier and entered the code

"customfield_13062": {"id":"[entry.smartdepart.ParentID]", "child":{"id":"[entry.smartdepart.ChildID]"}}

This works fine when both the ParentID and ChildID have ID's, but not all ParentIDs have ChildIDs

I get an error because Jira doesn't like that the child ID is blank. (edited error message below)

com.atlassian.sal.api.net.ResponseException: Error communicating with Jira, {"errorMessages":[],"errors":{"customfield_13062":"Child Option id '' is not valid"}}

Used JSON:  "customfield_13062": {"id":"32410", "child":{"id":""}} }} }' 

 

I tried null and I can't remember what else instead of a blank in the form, nothing worked. Eventually I put the code for the child input into the ID in the form and used the code

"customfield_13062": {"id":"[entry.smartdepart.ParentID]"[entry.smartdepart.ChildID]}

where

Parent ID = 11111

and

Child ID = , "child":{"id": "22222"

 

This code works, if there is no childID it doesn't try to set one, and Jira doesn't have a conniption fit, but if there is one it enters the missing API code. 

Further development of my ConfiForm led tofrustrations with the IFTTT not linking issues. I started picking it apart and if I hard code an ID or remove the "customfield_13062" line the IFTTT links issues just fine.

 

Is there a better syntax to allow Jira to accept there sometimes being a ChildID and sometimes not?

1 answer

Hello Brian.

I had the same problem and couldn't find a solution, but by trial and error I found out how to do it.

If you send no child field at all jira accepts that as no child selected.

Using your example, this should work:

"customfield_13062": {"id":"32410"}

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you