Hi,
I have three custom fields,
1. Multi select list (Sales Collateral)
2. Multi user picker (Sales Collateral Owner)
3. Single Checkbox (Sales Collateral Completed)
I wanted to make 'Sales Completed' (checkbox) ready-only, when 'Sales' and 'Sales Owner' fields are empty. vice versa.
Thanks in advance.
Thanks for your reply on this,
I have tried-
In behavior I added 'Sales Collateral Owner/s' field and I put 'server-side script'
added 'Sales Collateral' field and I put 'server-side script'
It works when 'Sales Collateral Owner/s' is not empty and 'Sales Collateral' is empty.
It works when 'Sales Collateral' is not empty and 'Sales Collateral Owner/s' is empty.
But I need it to work together. 'Sales Collateral Completed' enable when 'Sales Collateral' and 'Sales Collateral Owner/s' are not empty.
and I tried combine together and put it in the Initialiser not working anything.
Any help????
Thanks
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.
Hi @Teja
That's really good so far. I think you are close. How did you combine the 2 conditions together? Share the code, let us see why it is not working.
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the code:-
import com.atlassian.jira.component.ComponentAccessor
def salescol = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sales Collateral")
def salescolValue = underlyingIssue?.getCustomFieldValue(salescol)
def salescolown = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sales Collateral Owner/s")
def salescolownValue = underlyingIssue?.getCustomFieldValue(salescolown)
def salescolcom = getFieldById("customfield_15814") //Sales Colateral Completed customfield_14602
if (salescolValue && salescolownValue){
salescolcom.setReadOnly(false);
}
else{
salescolcom.setReadOnly(true);
}
Thanks
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.
Hi @Teja
Try this.
Add both the fields with the following code respectively.
Sales Collateral
def salescolValue = getFieldById(getFieldChanged()).getValue()
def salescolOwnValue = getFieldByName("Sales Collateral Owner").getValue()
def salescolCom = getFieldByName("Sales Collateral Completed")
if ( !salescolValue.toString().contains("null") && salescolOwnValue) {
salescolCom.setReadOnly(false)
}
else {
salescolCom.setReadOnly(true)
}
Sales Collateral Owner
def salescolOwnValue = getFieldById(getFieldChanged()).getValue()
def salescolValue = getFieldByName("Sales Collateral").getValue()
def salescolCom = getFieldByName("Sales Collateral Completed")
if ( !salescolValue.toString().contains("null") && salescolOwnValue) {
salescolCom.setReadOnly(false)
}
else {
salescolCom.setReadOnly(true)
}
Few things to note here.
Let me know if it works.
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried above suggestion
It works when I first enter value in 'Multiselect' field i.e. Sales Collateral and Sales Collateral value second.
But it did not work when I first enter Sales Collateral Owner and Sales Collateral second.
Anything wrong?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the exact type of Sales Collateral field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I enabled the dark feature and the behaviour still works for me. So not sure why it is not working for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your Sales Collateral field name is different. Change it in the code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good to know. Have a nice day.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you please share your inputs on the above questions.
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.