- Amr Hamza
- Jul 08, 2020
- feature-customfield
- Comment
2 answers
- 210
Just found the solution!
It's
Outgoing sync replica.customFields."Team" = issue.customFields."Team" Incoming sync if(replica.customFields."Team".value) { issue.customFields."Team".value = replica.customFields."Team".value?.description?.title?.toString().replace("\"", ""); }
CommentAdd your comment... - 10-1
Hello Amr Hamza
Can you confirm my rewording of your question
- Portfolio team bidirectional sync.
Blue Jira and Red Jira have both Portfolio- The teams are identical, and changing the team on Blue, will change it on Red
- The teams are not identical, and changing the team on Blue to a non existing team on Red will create the team on Red
- Portfolio team sync to a select list
- The selected blue team is setting the corresponding value in the red select list
- New blue teams lead to new entries in red
- Amr Hamza
Hello Francis Martens (Exalate) ,
Thanks for your reply.
- yes bidirectional
- exactly like that
- if the teams are not identical, it would be greate if we can map them and set a default value to fall back to in case of no match.
- also bidirctional (Blue Jira has Portfolio Team field, Red Jira has a single select field)
- Red selects an option in the field → Exalate sets the corresponding team in Blue.
- Blue selects a team in Portfolio → Exalate sets the corresponding option in the field in Red.
- The same idea with the mapping and the default value if no match was found.
- yes bidirectional
- Francis Martens (Exalate)
The first part is simple - in the outgoing sync of the connection add following statement
replica.customFields.Team = issue.customFields.Team
When a sync is happening the other side will receivereplica.customFiels.Team.description.title should contain the name of the team.
Applying to a select list is straightforward by using the getOption approach.
We are looking how to set the team field, it needs to go through the Portfolio/Advanced Roadmap api.
But this approach should already cover part 2 of the question - Amr Hamza
Thanks Francis Martens (Exalate) .
Agreed. I suppose the obstacle here is how to set the Portfolio Team field in the incoming sync rules.
- Amr Hamza
I hope you're well. Just wanted to check, if there is any progress here.
Thanks.
Cheers,
Amr
- Berry Kersten
hi Francis Martens (Exalate), I have an almost similar use case, except I just want to show the Team Name on the remote side.
I have created a new custom field (single text line) Team, and now it shows {"id":1,"description":{"title":"Team A","avatarUrl":{},"shareable":true}}
So, I suppose I have to trim this so that only Team A will be shown. Any idea how to do this kind of trimming? Thanks. - Francis Martens (Exalate)
Can you try
replica.customFields.Team = issue.customFields.Team?.description?.title
And let us know
- Berry Kersten
Thanks.
In that case, I'm getting an Cannot get property 'value' on null object
Outgoing sync:replica.customFields.Team = issue.customFields.Team?.description?.title
Incoming sync:
issue.customFields."Team".value = replica.customFields."Team".value
In remote issues I see:
Team (11001): {"id":3,"description":{"title":"Team IDE (C)","avatarUrl":{},"shareable":true}} - Francis Martens (Exalate)
Berry
Ah - I made a typo - better would be
replica.customKeys.Teamtitle = issue.customFields.Team?.description?.title
and on the incoming ...
issue.customFields."Team".value = replica.customKeys.Teamtitle
- Berry Kersten
Hmm, in that case no information is being synced: in remote issues there's no Custom Keys Teamtitle present.
It looks like it does not get the exact data within {"id":3,"description":{"title":"Team IDE (C)","avatarUrl":{},"shareable":true}}
- Francis Martens (Exalate)
Can you check what the value is of issue.customFields.Team?.description?.title by adding
throw new Exception("Title = ${issue.customFields.Team?.description?.title}")
in the outgoing sync. It should clarify if you get some information out of that customfield
- Berry Kersten
Sure, then I'm getting com.exalate.api.exception.script.ChangeProcessorException: Script error for issue RI-5024. Details: No such property: title for class: java.lang.String.
- Francis Martens (Exalate)
You will have to do some investigations.
Can you trythrow new Exception("Title = ${issue.customFields.Team.value?.description?.title}")
...
- Berry Kersten
Francis Martens (Exalate) Sure, in that case it returns: Details: Title = null.
- Francis Martens (Exalate)
In an earlier comment you indicated
I have created a new custom field (single text line) Team, and now it shows {"id":1,"description":{"title":"Team A","avatarUrl":{},"shareable":true}}
Where did you fetch this value?
CommentAdd your comment... - Portfolio team bidirectional sync.