Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

When Assignee = Unassigned sync fails on null value

 
1
0
-1

Creation of a new task sets assignee as 'Unassigned'
Ideally staff would set a user but at creation a user is not always decided on.


Problem arises when trying to exalate one of these tasks. 


Prior to this situation coming up I was simply using

//outgoing sync this side
replica.assignee.displayName = issue.assignee.displayName

//incoming sync on other side
issue.customFields."Remote Assignee".value = replica.assignee.displayName 

Error Detail Message:


Cannot get property 'displayName' on null object
Error line: 18


//outgoing sync this side
replica.assignee.displayName = issue.assignee?.displayName ?: "Unassigned"

To try and solve I believe this should work as something very similar worked under visual mode. 


Note: I am only passing the displayName as the user is not on the replica instance and is simply displayed on a custom field.


  1. Ariel Aguilar

    You can try to do instead:

    //outgoing sync this side
    replica.assignee = issue.assignee?.displayName ?: "Unassigned"

    Kind regards,

    Ariel


  2. Jonathan

    Thanks for the suggestion, Unfortunately that just results in error:


    Cannot cast object 'Unassigned' with class 'java.lang.String' to class 'com.exalate.api.domain.hubobject.v1_2.IHubUser'

  3. Ariel Aguilar

    If you just do:

    replica.assignee = issue.assignee

    What are you trying to achieve here?

    Kind regards,

    Ariel

  4. Jonathan

    This doesn't work as the users are not available on both sides. When we were using the visual method of connection to get around this I would set a custom text field to indicate the Reporter and Assignee.

    as shown here 


    I didn't think this should be hard to do but am quite stuck (sad) I simply want to set a custom field as the name text ie .displayName and if its a null then set any other string ,ie "Unassigned" or "N/A".

    The elvis operator '?:' was working under visual so its odd it wont work here. 




  5. Ariel Aguilar

    Is the remote assignee correct?

    issue.customFields."Remote Assignee".value = replica.assignee?.displayName 

    Maybe it should be replaced to:

    issue.customFields."SA assignee".value = replica.assignee?.displayName  
CommentAdd your comment...