ScriptRunner Behaviours with Tree CF

Issue #54 closed
Former user created an issue

When I try to use any scripting with a Tree field I get only null (for example formField.getValue()) Is there a way to use these to apps together?

Comments (12)

  1. Иван Донченко

    I do the same thing but not in Initializer - inside server-side script of the tree field.

    I want to catch every change done in the tree field and put values into a plain multi-string field. Apparently it only works if values already set previously (that’s why you can reach them through initializer)

  2. Иван Донченко

    So, I’ve checked and unfortunately it’s true, TreeField wouldn’t trigger fieldChanged event((( Could that be fixed?

  3. Sergey Knyazhentsev

    Hi Yuri,
    the version you’ve attached does fire the change event when you add a value, hovewer removing the value doesn’t.

    I made that conclusion by testing following code

    //def reqType = getFieldByName("Requirement Type").value
    def reqType = getFieldByName("Attribute/Function - New").getValue() as String
    def softTimer = getFieldByName("Soft Timer")
    def systemResponse = getFieldByName("System Response")
    int tabIndex
    if (issueContext.projectObject.key in ["LIB","REQ", "SDSE"]){
        tabIndex = 2
    } else {
        tabIndex = 3
    }
    //if (reqType == "Fault Monitor"){
    //if (reqType.contains("Fault Monitoring & Response")){  
    if (reqType && reqType.contains("339")){
        showTab(tabIndex) 
        systemResponse.setRequired(true)
        softTimer.setRequired(systemResponse.value == "PARK_ASAP")
    } else {
        systemResponse.setRequired(false)
        softTimer.setRequired(false)
        hideTab(tabIndex)    
    }
    

    When I set value 339 in my Tree field, the behaviour shows tab

    When I remove it - it doesn’t hide it

    If I set other value - it does hide it

  4. Yury Oboz repo owner

    I think a problem in this:

    def reqType = getFieldByName("Attribute/Function - New").getValue() as String

    this is not String it’s List, see attached below

    trigger “change“ fired on change value always

  5. Log in to comment