Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Set 'Labels' system field based on another Custom Field Value

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2024

Hi All,

I am struggling to Pre-set Labels field at the time of creation based on the value of another cf field.


1. For example, when i create a ticket with customfield_123 = XYZ, I want the system field 'Lables' to be 'NewIssue'. The Label field should be visible on create screen and read only.

2. When customfield_234 is ABC, i want customfield_789 to be as 'Admin', same as above I want customfield_789 to be seen in Create Issue screen and read only.

I am aware this has to be achieved via listener or behavior, if i am not wrong. Is it achievable?
Any help would be appreciated.

2 answers

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2024

Hi Harsh,

This will have to be done with a Behaviour, because listeners and post-functions can't alter data on issues that do not yet exist.

Behaviours can modify the way the create screen behaves.

The closest example I can find is https://library.adaptavist.com/entity/set-form-fields-from-issue-picker?tab=dataCenter which can change the values in fields on-screen on the fly.  It should not be hard to convert it to change the content of the labels field.

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2024

Hi @Nic Brough -Adaptavist- 

Thanks a lot for the update. I will give it a try and let you know. I feel that it will work based on the initial analysis, but will confirm once it works.

If you dont mind I do have an extra questions for you, if you can help with that -


- Can we restrict the 'customer request type' type field option in JSM project based on the issue type using behavior when creating the ticket from the JIRA(project level) and not from Portal(service desk)? Example - I have 3 request type (A,B,C), of issue type 'Incident' where C is hidden from the portal. Now when I create the ticket from project level(Jira) the request type is C is visible in the list for the field 'Customer Request Type'. I want to hide type C from the list in project level.

- If the above is not possible can we restrict creating ticket from project level in Service desk project for admin or any project role?

Thanks you for the help.

Harsh

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2024

I think Behaviours can do that, but I'm not sure because the request type field is effectively a system field.

I'm curious though.  If the type is not raisable in the portal, and it's not raisable via the issue creation, then why don't you just remove it?

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2024

Hi @Nic Brough -Adaptavist- 

Indeed it is a system field, so I am not sure whether we can get the values of the field, wrt to Issue type.

The reason I cannot remove because I need to hide and unhide custom fields based on the 'customer request type' from back end. So cant use behavior for issue type, because I need to restrict wrt to request type.

Thanks you.

0 votes
Sebastian Krzewiński
Community Champion
January 15, 2024

Hi @Harsh 

 

Did you consider to use Automations for Jira? It looks like best fit here.

 

Regards,

Seba

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2024

Hi @Sebastian Krzewiński 

Automation works if I want to hide the field from the create issue screen. But i dont want that, I want when a user selects customfield_123 = XYZ, the value for LABELS and customfield_789  should be set (live update you can say), and read only, on the time of creation. When the user is done filling the form, click submit.

Hope you get it now.

Sebastian Krzewiński
Community Champion
January 16, 2024

Hi @Harsh 

 

Thanks for additional comment. Sounds that you need Script runner feature called Behaviors. You can setup scenario described by you. 

Beware - Script runner is a paid add-on. I don't know anything which you can achieve same functionality.

 

Regards,
Seba

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2024

Hi @Sebastian Krzewiński 

I do use script runner, if you are aware of how to achieve this via script runner, please let me know.

Thanks.
Harsh

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events