Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create a list which is the difference of two People lists

Paul Benati July 5, 2023

Community,

System:  Jira Software for Cloud
Project type:  Team-managed

I'm attempting to create a list representing the difference between two lists containing multiple People fields.  I have two Jira Software multi-user custom People fields:  PeopleList1 and PeopleList 2.  PeopleList1 contains three users:  User1, User2, and User3.  PeopleList2 contains two users:  User1 and User3.  I want to create a variable that contains the difference between these two lists (i.e., User2).  Is this possible?  And if so, then how?  Thanks.

 

I've attempted to create a variable via the following smart-value logic, but clearly this isn't going to work.

{{#PeopleList1}}{{#if({{#PeopleList2}}{{accountId.match(accountId)}}){{accountId}}{{^last}},{{/}}{{/}}{{/}}

 

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2023

Hi @Paul Benati -- Welcome to the Atlassian Community!

Before proceeding...Please note that team-managed project's People fields have limitations in automation rules.  I believe there are several open defects on them not being usable in emails, notifications, etc. from rules.  If you need to do any of those things please check if what you want to do with the results is possible before proceeding.

Back to your question...

Short answer: I do not believe finding the list differences is easily possible with an automation rule's features.

Longer explanations:

  • Once inside of a list iterator (e.g., PeopleList1), other scopes are apparently not visible (e.g., PeopleList2).  And so I do not believe other fields in issues or variables are accessible.  It can only see the attributes of the iterator, and lower.
  • There are no Boolean operators AND, OR, NOT for list contents, or your scenario would be easy

One possible work-arounds would be: write an external service which can do this, pass in the lists with a web request, and use your results.

Kind regards,
Bill

Paul Benati July 6, 2023

Bill,

Thanks for the feedback.  

FWIW, in my actual case, PeopleList1 and PeopleList2 are changelog.from and changelog.to, respectively.  This missing capability seems like a natural fit for many changelog examples.

 

Paul

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2023

Thanks for clarifying. 

In your case you only want the differences and are using the change log for a single People field change.  I do not know if {{fieldChange}} works with people fields, but there are a couple of options there you may want to try:

{{addedFieldChange.valueIds}}
{{deletedFieldChange.valueIds}}

Those may provide just the added and deleted values, which you could combine for the differences only.  Try writing those to the audit log to see what happens...the documentation has some typos on the case of the smart values, so you may need to experiment.

Paul Benati July 6, 2023

Bill,

Many thanks.

 

Paul

Sanjivani Wayal July 25, 2023

@Bill Sheboy  how to use {{deletedFieldChange.valueIds}} in automation i need to get list of people who were deleted from approvers field , but how can i assign this to the custom field

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2023

Hi @Sanjivani Wayal 

What type of field is it?

If it is a text field, when you edit the field, you may type / paste in that smart value, it will appear below the field, and then you can select it.

If it is a multiselect user field, you instead could convert that value to a JSON expression, and set the field with an advanced edit: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Multi-user-picker-custom-field

Kind regards,
Bill

Sanjivani Wayal July 25, 2023

Hi,

 

I dont think  {{deletedFieldChange.valueIds}} is useful for me as it is removing all the values from other field where as i want to add the last removed value from this field to another field

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2023

This is different from what you originally asked:

...get list of people who were deleted from approvers field...

Regardless, I believe you are correct: unless the changes are done one value at a time, there is no way to determine the "last" one removed.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events