Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,051
Community Members
 
Community Events
168
Community Groups

Is it possible to create a linked issue per Insight Object in a custom field

Edited

Hi all,

I have an automation for onboarding that adds a number of insight objects to a single insight field as 'New starter requirements'

Is it possible then to look through the items in that custom field and create a linked issue per item that is going to act as a procurement ticket per item?

So basically if there was a laptop, phone and Adobe Acrobat I would end up with three linked issues, one for each of those items?

I can display the size of the lookupObjects (which would be 3 in this case), I can also write all the names of the objects to the log.

I just need some sort of loop to loop through the lookupobject while size > 0 and create a linked issue per item - the last part of the loop is what is eluding me.

thanks

1 answer

0 votes
Mark Segall Community Leader Aug 10, 2022

Hi @Steven Lees-Smith 

Yes... You can use an advanced branch like this:

2022-08-10_09-30-11.jpg2022-08-10_09-30-25.jpg

@Mark Segall AMAZING..   such a simple way to do it considering I had lookup objects, then a check for >0 then the smart value branch and it was all just getting confused..  very elegant in two steps.

A slight side branch to my question and I thought about this replicating your solution.

Do you know if there is a way to merge the contents of two Insight custom fields on a form into a third OR can you refer somehow to multiple fields in the Smart Value.

I was thinking that if there is a hardware insight field where someone can select their hardware options but also a software drop down also to combine the whole selection process into one form it would mean their are two insight custom fields on the form.

Could that be wrapped up in a merge or just have two different smart value variables created and then have two create a request nodes also just for the two variables?  The later makes sense, but I also did overly complicate something that was simple so thought I would ask :)

Like Mark Segall likes this

oh and also, seeing this is being triggered via automation in an issue I thought to put a 'Link Issue' in the step that is creating the new issue.  That isn't happening?

I have the simple step that after the create that is

Link Issues

Relates to - Trigger issue.  Trigger issue being the main issue that is kicking off the automation.

Not firing?

Mark Segall Community Leader Aug 10, 2022

Do you know if there is a way to merge the contents of two Insight custom fields on a form into a third OR can you refer somehow to multiple fields in the Smart Value.

I was thinking that if there is a hardware insight field where someone can select their hardware options but also a software drop down also to combine the whole selection process into one form it would mean their are two insight custom fields on the form.

Could that be wrapped up in a merge or just have two different smart value variables created and then have two create a request nodes also just for the two variables?  

So, to make sure I understand... Are you saying that currently you have a single insight field and you're looking to split it into multiple fields?  If so, I would just create a second branch rule based upon your second insight field and spawn issues accordingly.

I thought to put a 'Link Issue' in the step that is creating the new issue.  That isn't happening?

The reason this isn't working is because you're currently branched on a field variable and there's no issue anchor so when trying to create a link, it's attempting to link to itself.  However, you should be able to create the link in the same create issue action.  Just add the Linked Issues field to the create and then it should do the trick.

Like Steven Lees-Smith likes this

here is what I have, just isn't creating the linked issues.

Capture.JPG

I tried your suggestion and it errors out.   I tried relates to also.

Capture.JPGCapture2.JPG

@Mark Segall   to round off my problem, I can manually go into the main issue and create links to the new issues created in the Procurement project - so permissions and such seem all good... not sure what the issue is that is being spat out in the audit.

Mark Segall Community Leader Aug 11, 2022

When creating an issue, automation is leveraging whatever you have on the create screen.  So, you'll need to make sure the Linked Issues field is available on the target issue type screen scheme. 

NOTE - You may want to add a new screen tab and simply hide it there so it doesn't create noise for those who may create issues against that issue type manually.

Ah that wasn't at all apparent as in my testing I could manually create links from the trigger issue to the Proc issues, adding the 'Linked Issues' field made all the difference.

See now that I see more of this place something else has triggered.

Seeing the objects being stored in the Insight field all have a dollar value.  I should be able to have a variable created to store {{assets.cost}} and then add that to a rolling total to come up with a final total of all the items, just edit the issue at the end and display the 'total' variable I create.  I should be able to sum those together in the same sort of way that it pulls the name details out individually to create the linked issues?

Mark Segall Community Leader Aug 11, 2022

So are you saying that you want to have an additive asset cost as it iterates through creation of linked issues and then have the values of those issues add up and edit the parent issue?  If so, you'll have a couple gotchas to look out for:

  1. Variables captured inside a branch don't come out of the branch.  I've found in most cases if I create a variable before the branch and give it a value of 0, then I use that same variable inside the branch, the variable holds the data once it exits the branch
  2. Your variable will have an array when you're dealing with multiple iterations on that branch so you'll need to be able to split it to perform calculations against it. 

Here are a couple links to smart values that may help with what you're trying to do (Note - it may get complex):

Yeh I was just thinking about this one on the fly.

Each insight object that is in the custom fields on the trigger issue has an attribute of cost.  I thought (potentially incorrectly) that due to me being able to pull out the Name attribute to be used for the PROC issue I could pull out the cost attribute for each one and store that as an attribute on the triggering issue and then display the total there.

I'll have a look at the links and see how fast I pass Alice down the rabbit hole?

Hmm actually what I was thinking was dumb, the linked issues are created after approval but I was thinking of showing the total costs of the selected insight objects before approval so there are no linked issues.

As a side note, I managed to write the total of the cost from the linked issues to the log as a test.

 {{issue.issuelinks.outwardIssue.Cost.sum}}

That sums the Cost field on all the linked issues.

But again, it's too late in the process, I need this before approval...  back to the drawing board.

@Mark Segall Sorted this one out today.  Used the same value branching with the .Cost attribute added onto it.

I think have an edit issue that edits the Capex Total Value field with a sum of the Capex Total Field to the current value in the smart value.

It didn't work until I chucked a re-fetch issue data node into the mix and it's all fine now.

Thanks for your assistance with this one, greatly appreciated.

Like Mark Segall likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS

Atlassian Community Events