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

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

Create an issue only if an insight object does not exist Edited

We need a condition to validate if an object is already created in an object schema and do not permit to create an issue with this object value in a specific field.

Thank you

1 answer

I'm not 100% sure I understand your use case, but it sounds like you have:

  1. An Insight schema with objects
  2. An Insight custom field

You asked

a condition to validate if an object is already created in an object schema and do not permit to create an issue with this object in a specific field

First things first. 

  1. If you're trying to validate an issue upon creation, it would be a validator, not a condition
  2. If you have an Insight custom field on an issue create screen and you DON'T want the user to select an object which exists in a schema (I'll assume we're talking about the object as a reference attribute, since the field would always show no objects for selection...since ...they'd exist otherwise)

It sounds like what you might want is to alter the "Filter scope (IQL)" section in the field configuration to apply your logic. That way, the field will only show the objects which satisfy your logic.

For the 2nd bullet: I dont want an insight field. I want a text or integer field to fill and if this value does not exist as an object in insight then an issue and an object will be created.

I suppose I will use the insight post function but I will need help with the IQL condition

Thank you

So, it sounds like you're using an issue as the template to create an object.

You have a couple of options.

1. You can put all of your logic in the create workflow validator to determine if an object exists which matches the text or integer field. If the object already exists, throw an error message to the user and not let the issue be created. If the object doesn't exist, then create the object and let the issue creation succeed.

2. Let the issue get created, and then have either a post-function that performs the above work and then transitions the issue to a completed status with a resolution of "object created" or "denied" or something like that.

Like Anna Protopapa likes this

If I select the first option I suppose I will create a Validator on the Create transition. I will select Insight Validators --> Run a groovy script within this validator. 

Can you help me with the groovy code I will use?

I think you're correct. 

I don't unfortunately have a collection of Insight Groovy scripts yet. I would suggest starting to look at the examples originally provided by Mindville

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
4.8
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