Forums

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

Function to update a customfield's configuration scheme Project-list

JIRA-Support ZKB November 15, 2021

Hi there

Customfields can be limited to a list of projects with Field Configuration Schemes. 

I created customfields, displaying a warning message. Those fields should only be visible for some projects, according to a project category.

I try to write a script with ScriptRunner to update dynamically the list of projects for those fields – when a project category changes or when I create a new project for example.

 

I found the way to get the list of projects from a customfield's configuration:

 

FieldConfig fldConfig
if (schemes != null && !schemes.isEmpty()) {
    // Get the 1st field Configuration - should be the default configuration   
    FieldConfigScheme sc = schemes.get(0);
    dbgLog.debug("Field Config: " + sc.getName())

    // Get the list of projects for this config - if empty, then global.
    lstPrj = sc.getAssociatedProjectObjects()

 

Now I want to update this list: add or remove projects.

I couldn't find any function allowing that.

Has anybody an idea ?

Thanks in advance !

2 answers

0 votes
JIRA-Support ZKB November 18, 2021

Is there anywhere a kind of "setAssociatedProjectObjects ?" function ?

Joshua Sneed Contegix
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.
November 19, 2021
JIRA-Support ZKB January 7, 2022

Hi Joshua

I didn't realize that your "Maybe" was a link ...

Ok, so I go deep-dive in Atlassian Jira Dev Doc.

If you have a hint ... :)

Regards,

Pascal

Joshua Sneed Contegix
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 10, 2022

Hi ZKB,
I am not familiar with the JAVA API to offer any further assistance. You may want to consider using a Scriptrunner listener/behaviour to directly post the message instead of using a custom field. Cheers!

0 votes
Joshua Sneed Contegix
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.
November 15, 2021

Hi JIRA-Support ZKB,

I do not know how to accomplish what you are inquiring about, but think there is a risk of data loss. Removing a project from a fields context "may" result in the values for that field to be lost for the entire project. Cheers!

JIRA-Support ZKB November 16, 2021

Hi Joshua

Actually, those fields are "Message Custom Fields". They just display a message.

But thank you for your answer !

 

Pascal.

Suggest an answer

Log in or Sign up to answer