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

How to extract and copy common values from two user picker custom fields into a new field?

Jakeer April 8, 2024

Hello Team,

We have created Two User picker custom fields and added agents in it. Where Custom Field 1 has values A, B, C and Custom Field 2 has values A, B, C, D, E, F.  Since A, B, C are the common values those values need to be copied into a new user picker custom field. How can we achieve this requirement,

Any quick suggestions will be more helpful.

Thanks,

2 answers

0 votes
Kalyan Sattaluri
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.
April 16, 2024

Hello @Jakeer 

I just tested and it worked for me so I am not sure whats wrong with your set up.

Only thing I notice is that in your edit issue section, you are unncessarily choosing a field..

Nothing should be selected in the "Choose fields to set".. Only the advanced section should be set.

It should be like below screenshot..  notice I have no fields selected.. you have choosen "JSMField" in that dropdown.. we dont need to do that..

image.png

0 votes
Kalyan Sattaluri
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.
April 8, 2024

Hello @Jakeer 

Are you asking how to do this using Automation or using script execution? Not clear from your post/..

 

Jakeer April 8, 2024

Hello @Kalyan Sattaluri

Sorry for not explaining in detail.

We need this through Automation rule.

Thanks,

Kalyan Sattaluri
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.
April 8, 2024

Hello @Jakeer 

What will be your trigger? Manual or Field Change? Or something else.

Lets assume its either Manual or Field change. (otherwise it gets complicated)

You do Advanced Branching after trigger to compare 2 fields and if value exists, update the third.

Lets assume your 3 fields are customfield_1000 , customfield_1001, customfield_1002.

where 

  • customfield_1000 has A, B,E
  • customfield_1001 has A, C, D, E
  • And you want to store A, E in customfield_1002

Steps:

  • After your trigger,
  • you do advanced branch, choose one of the fields to iterate, give it a name,(for ex "myagents")
  • then in next step, if condition -> advance compare -> smart value, check if the value is present in other field, (see screenshot, notice what we are checking against and implement the same way)
  • if so, add it to other (customfield_1003)field using advanced edit using below JSON:

{
"update": {
customfield_1003" : [
{
"add": {
"id":"{{myagent}}"
}
}
]
}
}

 

I havent tested this because I dont have this many fields, please see screenshot, implement and share your rule and audit log section to review.

image.png

 

Your Edit issue should use advanced Edit like below:

image.png

Jakeer April 8, 2024

Hi @Kalyan Sattaluri

Good Morning!

Thanks for your help. 

I have tried the automation rule you sent and the rule is not working as expected.

I have created an automation rule where is copied the Assignee Group Values into "User in groups" Custom field and Organization values into "User in Organizations" custom field.

Such that the values in User in Groups= Jakeer and Malisha if Assignee Group = L1 helpdesk

        Values in User in Organizations = Malisha if Organization = HSBC 

The common values present in the two custom fields are getting copied with the automation you provided. If both the members are in both the custom fields User in Groups and User in organizations then the values are not getting copied only one value either Jakeer or Malisha name is getting copied in the new field "myagents"

With the Automation rule you described I have tried and when i change the values the names are not getting changed although they are not part of assignee group or Grouporganization their names are remained same without changes in the field.

Regards,

 

Jakeer April 8, 2024

04092024.png

Jakeer April 8, 2024

I have shared the screenshot where i am not part of Organization still my name sowing after changing the values.

Also If Jakeer and Malisha both are part of both the fields then both the names are not getting copied in the customfields-3

Jakeer April 9, 2024

09042024.png

Jakeer April 9, 2024

In the above screenshot both the values are present in both the custom fields still only one value copied in the customfield-3 which is myagents field.

Kalyan Sattaluri
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.
April 9, 2024

Hello @Jakeer 

You need to share with me the detailed screenshots of the rule you have written including audit logs.  Unless you share those, I cannot tell anything.

Again, I need screenshots of your advanced branch, your if condition, your edit issue and audit log of the run.

Jakeer April 12, 2024

Hello @Kalyan Sattaluri

Sorry for the late response.

Please find the attached screenshots of the automation rule.04122024-1.png04122024.png04122024-2.png04122024-4.png04122024-3.png

 

Thanks,

Jakeer April 12, 2024

Hi @Kalyan Sattaluri

I am using the above automation rule to separate the agents who belongs to User in Groups as well as User in Organizations. 

If in User in Groups = A, B, C, D,E

If in User in Organization = A,C,E

Then in myagents = A,C,E 

But the above rule is not working as expected, it is randomly taking values although if they are not part of User in Groups as well as User in Organizations. 

Can you plz look into it.

Jakeer April 12, 2024

Result-04122024.pngAuditlog04122024-.png

 

Here in User in Groups and User in Organizations you can see that Jakeer and Malisha are part but in my agents you can see only one name got copied.

 

Thanks,

Kalyan Sattaluri
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.
April 12, 2024

Hello @Jakeer 

Is customfield_10080 called myagents? Can you rename that field to something else?

Also, in the last step, you can remove updating the "Approvers" field, unless you want that.

If you cannot rename customfield_10080 to something else, you need to rename the variable from myagents to something else and update your if condition and also the last step where in advanced edit you are referencing {{myagents}}. replace every where in the rule where the variable is being referenced with the new variable name..

So do either of the steps, retrigger the rule and share the log once again,

Jakeer April 12, 2024

Hi @Kalyan Sattaluri

I have made the changes mentioned and in the result i am getting error.04122024-error.png

Please find the attached logs screenshot.

 

Thanks,

Kalyan Sattaluri
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.
April 12, 2024

What is the customfield_10080 field called?

Is it approvers?

Also what change have you made? Did you change the variable name? If so, share with me the screenshot of where variable is being defined in advanced branch and also edit issue screen.

 

Jakeer April 12, 2024

Hi @Kalyan Sattaluri

customfield_10080 is the field name myagents.

JSMField.png

Please find the attached screenshot.

Thanks,

Jakeer April 12, 2024

edit.png

Kalyan Sattaluri
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.
April 12, 2024

Remove the highlighted section below from edit/issue in your rule and retrigger and let me know what you observe

image.png

Jakeer April 12, 2024

Hi @Kalyan Sattaluri

I have tried the same way mentioned still getting error.

error.png

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

Is there any update on my requirement?

Thanks

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

Can you help me if it is possible through script in jira cloud.

If Assignee Group = L1heldesk

If Group(Organization) = HSBC then in

User in Groups = The all members present in L1helpdesk should be copied in this field.

User in Organizations= The all members present in HSBC should be copied in this field.

Finally the common members in User in Groups and User in Organizations needs to be copied in "myagents" field.

Thanks,

Kalyan Sattaluri
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.
April 16, 2024

Jakeer, First share with me the Edit issue screenshot again. That error means we are trying to update the same field in multiple places. And we need to remmove references to that field. So share screenshot to resolve that issue firts.

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

Please find the attached screenshot of my edit issue.

edit issue.png

Thanks,

Kalyan Sattaluri
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.
April 16, 2024

Hello, in the drop down "Choose fields to set", unselect the field "myagents"..

It should just be the advanced section...

see below screenshot and rerun the rule and share audit log.

image.png

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

After making the changes the automation showing errors and the audit log screenshot is shared below.

Result1.png

Thanks,

Kalyan Sattaluri
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.
April 16, 2024

Jakeer,

I want you to do 2 things:

1) In the advanced edit, you need to change {{myagents}} to {{JSMField}} .. right now you are trying to edit field with itself. See screenshot where I am referring to.

2) Insert a new log statement above where you are logging {{JSMField}} and log {{User in Organizations}} . 

Do both, rerun the rule and share audit log.

image.png

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

I made the changes mentioned above, in result automation is showing success.

But the values are not getting copied exactly.

If in User in Groups= A, B,C,D

If in User in Organizations = A,C,D

Common values are A,C,D But only A, D are getting copied if i refresh then A, C are getting copied then after i remove all values and refresh then all the values are getting copied.

new-.png

Thanks,

Jakeer April 16, 2024

Hi,

You can see the result.

common.png

Kalyan Sattaluri
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.
April 16, 2024

Can you select the "For Each smart value" and share the screenshot. I need to see both the steps and For Each details section together like in below screenshot..

I *think* I know the issue and we may have to store these values teemporarily before we update.. but yes, please select For Each and share with me the screen shot..

image.png

Jakeer April 16, 2024

Hi,

Please find the screenshot.

jsm.png

Thanks,

Kalyan Sattaluri
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.
April 16, 2024

Hello Jakeer,

I need the For Each section's details.. not the edit issue. lol

Also, the earlier log statement should be {{User in Organizations}} and not {{User in Organization}}.. please correct this..

Please share with me the screen shot of "For Each" and a newly run audit log so i can compare..

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

My bad I didn't share the correct screenshot.

smart.png

Jakeer April 16, 2024

new log.png

Kalyan Sattaluri
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.
April 16, 2024

Hello @Jakeer 

I just tested and it worked for me. Only think I notice is that in your edit issue, you are again choosing a field in the "Choose fields to set" drop down... There should be no selection... We are using advanced section to edit the issue. Your edit issue screen should be like my below screenshot..

 

image.png

Jakeer April 16, 2024

Hi @Kalyan Sattaluri

I made the changes and tested in the result i am getting-

2.png1.png

Thanks,

Jakeer April 16, 2024

Hi,

In the above screenshots you can see that the all common values in the teo groups are not getting copied.

final.png

Thanks,

Kalyan Sattaluri
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.
April 16, 2024

Hello @Jakeer 

Hope you are doing well. Looks like we have run into a bug in Jira here. 

Looks like when we are trying to "add" within a For /Each logic, its not completing all the steps.

I am also able to reproduce the issue but I dont have a solution yet.

Let me think some more and I will update you if I find a work around. Apologies for all the back and forth with no solution.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events