How to write postfunction to set values in a custom field based on values selected in another field

metzo4102 January 22, 2020

Hi all,

I have a custom field called teams with several values such as a,b,c,d,...  I have another custom field called sub-team with different values such as 1,2,3,4...  I want to create a postfunction that will set the sub-team based on the value chosen in team.  I'm wondering what script I would create to do that.  

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2020

This might help - https://library.adaptavist.com/entity/copy-field-value-from-linked-issue - strip the bit about reading down links and apply the field (after translating) to the current issue.

metzo4102 January 24, 2020

Thanks Nic, but that's not quite what I'm looking for.  I want the workflow to set a second custom field based on what's selected in a first custom field.

In other words, If first_field = "A,B", then second_field = "1,2".  If first_field = "C,D,E", then second_field = "3".  The values in the fields for both the first_field and second_field are not the same.

Both fields are singleSelect Fields.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2020

Yes, I know it's not exactly what you need, but it is code that will write the sort of changes you want to make.  You just need to adjust it to do what you need.

Suggest an answer

Log in or Sign up to answer