# Update local field when local issue execute sync

**URL:** <https://community.exalate.com/t/update-local-field-when-local-issue-execute-sync/4228>\
**Category:** General Questions\
**Tags:** onpremise-jira, migrated\_question\
**Created:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/update-local-field-when-local-issue-execute-sync/4228 "2024-11-04T06:40:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/update-local-field-when-local-issue-execute-sync/4228/1 "2024-11-04T06:40:14Z")

</div>

_Originally asked by Peter Friberg on 19 May 2020 [(original question)](https://oldcommunity.exalate.com/questions/11339553)_

* * *

For two synced issues, I need to find a way to show which issue was the one with the last update (the one who triggered sync the last time).  
Considering a field “Last updated By” [Instance 1 | Instance 2] at both issues.  
The use case is two teams collaborating and they need a way to show who has the next action. Workflows are not compatible.  
A thought was to set a local value at outgoing sync, but that seems not possible.  
Any suggestions?

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 6:40am UTC](https://community.exalate.com/t/update-local-field-when-local-issue-execute-sync/4228/2 "2024-11-04T06:40:15Z")

</div>

_Answer by Juan Grases on 19 May 2020_

You could send over the updated field:

```auto
//Outgoing:
replica.updated = issue.updated

```

And then update a custom field of type datetime on the incoming:

```auto
issue.customFields."Remote updated".value = replica.updated

```

Let me know if this works.

* * *

#### Comments:

> **Peter Friberg commented on 20 May 2020**
>
> > Just to clarify: Suppose you mean that the Outgoing part is on “Instance 1”, and the incoming part is on “Instance 2”.
> 
> I can’t see how the user would have benefit of that, unless we can compare the “Instance 1” “Remote updated” with “Instance 2” “Remote updated”
> 
> What about this (I don’t dare to test it. Risk for infinite loops?):
> 
> Instance 1 incoming:
> 
> `issue.customFields.``"last updated by"``.value = "Instance 2"`
> 
> `...`
> 
> `syncHelper.syncBackAfterProcessing()`
> 
> Instance 2 incoming:
> 
> `issue.customFields.``"last updated by"``.value = "Instance 1"`
> 
> `...`
> 
> `syncHelper.syncBackAfterProcessing()`

> **Peter Friberg commented on 27 May 2020**
>
> > Any comments on this Juan Grases

> **André Leroy-Beaulieu Castro commented on 02 July 2020**
>
> > Hi Peter,
> 
> You can have the Outgoing line on both instances:
> 
> ```auto
> replica.updated = issue.updated
> 
> ```
> 
> then on Incoming on both sides you can have this logic:
> 
> ```auto
> if (replica.updated > issue.updated) {
> issue.customFields."Remote updated".value = replica.updated
> }
> 
> ```
> 
> so that it only updates the field when the updated date received is newer than the current one in the custom field.
> 
> Let me know if this would work for you!
> 
> Thanks,
> 
> André
