These are the requirements for a behavior I am trying to do using two fields
Release Notes is a Multi-line Text field
Use Release Notes is a Checkbox field with Yes as an option
By default, Release Notes is hidden
Requirements
1. When "Use Release Notes" is Yes and Release Notes is NULL, populate Release Notes with ABCDE and unhide it.
2. When "Use Release Notes" is Yes and Release Notes is NOT NULL, do not overwrite Release Notes and unhide it.
3. When "Use Release Notes" is NULL, clear Release Notes and hide it. If "Use Release Notes" is ticked once again, populate Release Notes with ABCDE and unhide it.
Initialiser below:
def childField2 = getFieldByName("Release Notes")
childField2.setHidden(true)
Here is my script on the field "Use Release Notes"
def childField1 = getFieldByName("Use Release Notes")
def childField2 = getFieldByName("Release Notes")
def childField1o = childField1.getValue() as String
def childField2v = childField2.getValue() as String
//def parentField = getFieldById(getFieldChanged())
//def selectedOption = parentField.getValue() as String
def defaultValue = "ABCDE"
if (childField1o == "Yes" && childField2 == null)
//if (childField1o == "Yes")
{
childField2.setHidden(false)
childField2.setFormValue(defaultValue)
}
else if (childField1o == "Yes" && childField2 != null)
//else if (childField1o == "Yes")
{
childField2.setHidden(false)
}
else
{
childField2.setHidden(true)
childField2.setFormValue(null)
}
Problem is, the ABCDE is not applied. Can someone please comment on the code? Appreciate it very much.
Hi @Marc Jason Mutuc ,
I would use childField2v instead of childField2 and test it against an empty string :
if (childField1o == "Yes" && childField2v == ""){ ....
else if (childField1o == "Yes" && childField2v != ""){ ...
Antoine
Works! I have a similar ticket for support and they are still asking for logs. Decided to go here as usual which gives better responses.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.