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

Copy field from Trigger issue as JSON?

I am looking for examples of what a JSON payload would look like for:

Copy Field from Trigger Issue

We are basically cascading data in fields from Epics, to Tasks, then sub tasks

 

Any examples would be helpful

1 answer

0 votes
Simeon Ross Atlassian Team Nov 10, 2020

Hey @Mark Almeida-Cardy,

Can you provide a bit more context? I'm not really sure what your question is about/trying to get to?

Cheers,

Simeon.

Simeon,

I am looking for some advice on how to copy the values from a trigger issue to a new issue using JSON. I am able to copy other fields without issue, however, drop-down fields (single select) are throwing an error:

Error: Could not find valid 'id' or 'value' in the Parent Option object.

An Example of the JSON payload is:

{
"fields": {
"customfield_10251":"{{triggerIssue.fields.customfield_10251}}",
"customfield_10253":"{{triggerIssue.fields.customfield_10253}}",
"customfield_10269":"{{triggerIssue.fields.customfield_10269}}",
"customfield_10270":"{{triggerIssue.fields.customfield_10270}}",
"customfield_10250":"{{triggerIssue.fields.customfield_10250}}"
}
}

Simeon Ross Atlassian Team Nov 11, 2020

Hi @Mark Almeida-Cardy,

 

No worries, with you now. So the best thing to do with these fields is have a look at how they're represented in the rest view (XXXX.atlassian.net/rest/api/2/issue/SP-49?expand=names). In the case of my sample project a custom drop down when set on an issue and viewed via the above URL, looks like this:

...

customfield_11200: {
self: "https://codebarrel.atlassian.net/rest/api/2/customFieldOption/10101",
value: "2",
id: "10101"
},

...

So, with that in mind, we need to set the id in the same format in the advanced JSON:

{
"fields": {
"customfield_11200": { "id": "10101" }
}
}

or, using a smart value:

{
"fields": {
"customfield_11200": { "id": "{{triggerIssue.etc}}" }
}
}

Hopefully that helps and makes sense :)

 

Cheers,

Simeon.

Simeon,

Yes, make perfect sense.  Thank you!

For single select drop downs, I found that "value" was required.

"customfield_10254": { "value": "{{triggerIssue.fields.customfield_10254}}" 

 

However, I still have one outstanding field that isn't pulling through.  What are your thoughts on User lookup fields?  I have tried both of the following with no luck or errors to referance.

"customfield_10250": { "accountId": "{{triggerIssue.fields.customfield_10250}}"

 

"customfield_10250": { "displayName": "{{triggerIssue.fields.customfield_10250}}"

I fact,   I have solved this thanks to your guidance.  Lookup fields look like so.

"customfield_10250": { "accountId": "{{triggerIssue.fields.customfield_10250.accountId}}"

 Thanks Again.

Simeon Ross Atlassian Team Nov 12, 2020

No worries mate! Nice work :D

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Why you should move agile planning to Lucidspark’s digital whiteboard

During my 17 years as a coach, mentor, and trainer of Agile teams, I’ve participated in hundreds of Agile planning meetings. The end result was a wall of backlog items annotated by an explosion of co...

91 views 0 5
Read article

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