We have a requirement like..while creating or updating issue users are providing the values and that values should not be duplicated.
For example: let say there is a label type field and already that field has TEST value for an issue and while creating/updating new issue a user should not add TEST value.
Any suggestions will be appreciated.
Note: It's not like only for Label type field if you have any idea or suggestion to achieve this then also welcome. The main purpose is ..user should be able to add multiple values to that field and the values should not be duplicate.
Other than restricting who can create labels using scriptrunner behavior plugin or using the component field, there is no way to prevent people from creating other labels that do not match the one you already have.
I will lean more towards the component field because it is clear that the project admin is the only person who can add component.
Thanks for your response.
What im thinking is ..we can do it using a script validator where we can fetch all the values of the field and then check whether the new field value is equal to existing value or not.
if so, then we should throw an error called this value already exist.
What do you think?
This could be possible but then resource intensive as you will either need to do this from a cron service, or by event listener which means issue update event that I cannot recommend.
This also does not scale because if a label has already been used, how does the script determine which to delete and depending on how many issues you have and how many labels per issue it could mean an issue update takes multiple minutes to be completed.
Hence, though this is possible, I cannot recommend it. Instead as suggested earlier constrain available Labels to those someone created and other users can then select from this when they type.
Hi @Ismael Jimoh , Yeah I understood but here the problem is we are using a multiline text field where users need to enter the alphanumeric character which is generated in SAP while creating/updating issue manually, so sometimes users are adding same alphanumeric character which is already added by someone on issue.
So my team manager wants that the user should not add the same value.
How we can restrict this.
Actually, while implementation we used multiline text field but while adding data to this text field users are entering semicolon, comma, colon (: , ;) for value separation and also adding duplicate values to avoid the value separator I thought like we should go for label type custom field so that user don't need to add separator here...so with this label type cust field now i want to avoid value duplication.
Hole it clear.
Hi @Yogesh Mude
Do the following:
Your final solution should look like:
When user attempt to add values to the label, it will bring up the edit screen and the field will be locked to them still.
Yes, using the script we did it.
First, you need to fetch the values of the label field and see if the user is entering the same values which are already contained. if so, then set the error saying XXX values already exist or contain with XXX issue key. if not, then allow the user to add it.
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