Exception Handling

Issue #259 resolved
jtabatabai created an issue

Fidel,

I am attempting to work around a scenario that currently triggers an error. I have two multi user picker lists, System Owner(s) and Approved By. I want to get the first user in System Owner(s) that in not in Approved By. I have been able to do this successfully with the 'Copy a parsed text to a field' post function (see below).

first_and_expect_exception.png

This works perfectly as long as a user is returned from the call to except(). However, if no users are found (which is a possible scenario), then the call to first() is throwing an exception ("Index: 0, Size 0"). Do you know how I can handle this exception or a potential workaround? Your help is greatly appreciated!

Comments (3)

  1. Fidel Castro Armario repo owner

    Hi,

    You should be using a version of the plugin previous to 2.2.8, since version 2.2.8 returns null instead of throwing an error. So, you simply have to update to version 2.2.8.

    Anyway, in case you can't update your version in this moment, you can use the following expression:

    count(toStringList(%{aaaaa}) EXCEPT toStringList(%{bbbbb})) > 0 ? first(toStringList(%{aaaaa}) EXCEPT toStringList(%{bbbbb})) : null
    

    replacing aaaaa and bbbbb with the corresponding field codes in your particular JIRA instance.

  2. jtabatabai reporter

    Bravo! That fixed it. Apologize, I was on version 2.2.7 and not 2.2.8 like I thought I was. Thanks for the very quick turnaround!!!

  3. Log in to comment