# Synchronizing System field with a cascade select value

**URL:** <https://community.exalate.com/t/synchronizing-system-field-with-a-cascade-select-value/4087>\
**Category:** General Questions\
**Tags:** onpremise-jira, feature-customfield, migrated\_question\
**Created:** [November 4, 2024, 6:29am UTC](https://community.exalate.com/t/synchronizing-system-field-with-a-cascade-select-value/4087 "2024-11-04T06:29:27Z")\
**Posts on this page:** 4\
**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:29am UTC](https://community.exalate.com/t/synchronizing-system-field-with-a-cascade-select-value/4087/1 "2024-11-04T06:29:27Z")

</div>

_Originally asked by Sujan Karanjeet on 25 September 2019 [(original question)](https://oldcommunity.exalate.com/questions/3703756)_

* * *

Hi,

I’m trying to synchronize a system field “Affects Version/s” (affectedVersions) to a value from a cascade field.  
I’ve tried the following but it does not seem to work. Could you please help me on this?

if (replica.customFields.“Product”?.value?.child?.value != null) { issue.affectedVersions = replica.customFields.“Product”?.value?.child?.value }

_Here, “Product” is a cascade select with a parent and child values._

BR,  
Sujan

* * *

---

<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:29am UTC](https://community.exalate.com/t/synchronizing-system-field-with-a-cascade-select-value/4087/2 "2024-11-04T06:29:29Z")

</div>

_Answer by Sujan Karanjeet on 27 September 2019_

Hi Francis,

I’ve been getting the following error after I tries your suggestion and I’m not able to find the reason for it as well.Could you please help.

### Error Detail Message:

Script error details: No such property: firstSync for class: Script6014. Error line: Script6014.groovy:86

### Error Stack Trace:

com.exalate.api.exception.script.CreateProcessorException: Script error details: No such property: firstSync for class: Script6014. Error line: Script6014.groovy:86 at com.exalate.error.services.ScriptExceptionCategoryService$.wrapAsCreateProcessorException(ScriptExceptionCategoryService.scala:53) at com.exalate.processor.jira.JiraCreateIssueProcessor.createIssue(JiraCreateIssueProcessor.java:147) at com.exalate.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.java:73) at com.exalate.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.java:24) at [com.exalate.replication.in](http://com.exalate.replication.in).RequestProcessorService.processSyncRequest(RequestProcessorService.java:324) at [com.exalate.replication.in](http://com.exalate.replication.in).RequestProcessorService.processSyncRequestsForIssue(RequestProcessorService.java:181) at [com.exalate.replication.in](http://com.exalate.replication.in).RequestProcessorService.processSyncRequests(RequestProcessorService.java:128) at [com.exalate.replication.in](http://com.exalate.replication.in).RequestWorker$1.run(RequestWorker.java:81) at com.exalate.util.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:32) at [com.exalate.replication.in](http://com.exalate.replication.in).RequestWorker.run(RequestWorker.java:74) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: com.exalate.api.exception.script.ScriptException: No such property: firstSync for class: Script6014. Error line: Script6014.groovy:86 at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:35) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:43) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:34) at com.exalate.processor.jira.JiraCreateIssueProcessor.executeCreateProcessor(JiraCreateIssueProcessor.java:215) at com.exalate.processor.jira.JiraCreateIssueProcessor.createIssue(JiraCreateIssueProcessor.java:131) … 15 more Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: firstSync for class: Script6014 at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:71) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:41) … 18 more Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: firstSync for class: Script6014 at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:348) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:145) … 21 more Caused by: groovy.lang.MissingPropertyException: No such property: firstSync for class: Script6014 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231) at Script6014.run(Script6014.groovy:86) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:345) … 22 more

BR,

Sujan

* * *

#### Comments:

> **Francis Martens (Exalate) commented on 27 September 2019**
>
> > On what version of Exalate are you. If it is pre 4.6, you will get this error

> **Sujan Karanjeet commented on 27 September 2019**
>
> > Thanks, I updated it to 4.6 to get the sync. working. However, I didn’t get anything in the “Affects Version”.

> **Francis Martens (Exalate) commented on 27 September 2019**
>
> > It is always helpful to see what the end result is of all that hard work
> 
> ```auto
> import com.exalate.api.exception.IssueTrackerException
> 
> def foundVersion = nodeHelper.getVersion(targetVersionName,targetProject)
> throw new IssueTrackerException("Found version for '${targetVersionName}' in project '${targetProject}' is '${foundVersion}' }
> 
> ```
> 
> The exception will throw an error providing the message.
> 
> Massaging the script will get what you want.
> 
> Please give it a try and let me know

> **Sujan Karanjeet commented on 01 October 2019**
>
> > Hi Francis,
> 
> I’m not getting value for the parent cascade field. I get “com.exalate.basic.domain.hubobject.v1.BasicHubProject@5866c90” in the cascade field’s parent value.
> 
> Script error details: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: Found version for ‘6.9.1’ in project ‘com.exalate.basic.domain.hubobject.v1.BasicHubProject@5866c90’ is ‘null’. Error line: Script607.groovy:98
> 
> BR,
> 
> Sujan

> **Francis Martens (Exalate) commented on 01 October 2019**
>
> > Can you check if the versionName is existing in the project? With the following statement you can extract the key
> 
> ```auto
> import com.exalate.api.exception.IssueTrackerException
> 
> def foundVersion = nodeHelper.getVersion(targetVersionName,targetProject)
> throw new IssueTrackerException("Found version for '${targetVersionName}' in project '${targetProject}' (${targetProject.key}) is '${foundVersion}' }
> 
> ```

> **Sujan Karanjeet commented on 02 October 2019**
>
> > Hi Francis,
> 
> I have the following lines included in my create processor. Not sure what I’m doing wrong. Could you please help? I don’t get any project or the project key.
> 
> // default to ‘1.0’ if the product child has no value  
> def targetVersionName = replica.customFields.“Product”?.value?.child?.value ?: “1.0”
> 
> // getVersion needs a project object. During the firstSync this is not set yet  
> def targetProject = firstSync ? nodeHelper.getProject(“DEMO”) : issue.project
> 
> ```auto
> issue.affectedVersions += nodeHelper.getVersion(targetVersionName,targetProject)
> 
> ```
> 
> import com.exalate.api.exception.IssueTrackerException
> 
> def foundVersion = nodeHelper.getVersion(targetVersionName,targetProject)  
> throw new IssueTrackerException(“Found version for ‘${targetVersionName}’ in project ‘${targetProject}’ (${targetProject.key}) is ‘${foundVersion}’”)
> 
> BR,
> 
> Sujan

> **Francis Martens (Exalate) commented on 02 October 2019**
>
> > What is the throw throwing
> 
> Does the project ‘DEMO’ exists

> **Sujan Karanjeet commented on 03 October 2019**
>
> > Hi,
> 
> I’m using the project “Test”, with key “TEST” and here’s the exception:
> 
> Found version for ‘6.9.1’ in project ‘com.exalate.basic.domain.hubobject.v1.BasicHubProject@5866c90’ (TEST) is ‘null’. Error line: Script1066.groovy:91
> 
> BR,
> 
> Sujan

> **Francis Martens (Exalate) commented on 03 October 2019**
>
> > Try
> 
> ```auto
> def versionList = issue.project.versions.collect { "'${it.name}'" }.join(", ")
> throw new IssueTrackerException("Versions = ${versionList}")
> 
> Can you check if the version you are looking for is in the list?
> 
> ```

> **Sujan Karanjeet commented on 04 October 2019**
>
> > I get the versions fine: Versions = ‘5.7.0’, ‘5.8.1\_HW’, ‘5.7.1’, ‘5.7.2’, ‘5.9.0’, ‘5.1.1 dev’, '5.9.…"
> 
> And I get the targetVersionName with:
> 
> def targetVersionName = replica.customFields.“Product”?.value?.child?.value ?: “1.0”
> 
> However, I cannot get the project.
> 
> def targetProject = firstSync ? nodeHelper.getProject(“TEST”) : issue.project
> 
> This is the command that’s failing.

> **Francis Martens (Exalate) commented on 05 October 2019**
>
> > Given all this information
> 
> - TargetProjectKey = TEST
> - TargetVersionName = 6.9.1
> - VersionList is ‘5.7.0’, ‘5.8.1\_HW’, ‘5.7.1’, ‘5.7.2’, ‘5.9.0’, ‘5.1.1 dev’, '5.9.…
> - nodeHelper.getVersion is returning **null**
> - Can you confirm that the version is in the versionlist and the method is not found?

---

<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:29am UTC](https://community.exalate.com/t/synchronizing-system-field-with-a-cascade-select-value/4087/3 "2024-11-04T06:29:30Z")

</div>

_Answer by Francis Martens (Exalate) on 25 September 2019_

Hi Sujan Karanjeet

You need to allocate a version object to affectedVersions. So you need to find the correct version using the [GetVersion](https://docs.idalko.com/exalate/x/xQBf) method

Something like

```auto
// default to '1.0' if the product child has no value
def targetVersionName = replica.customFields."Product"?.value?.child?.value ?: "1.0"

// getVersion needs a project object. During the firstSync this is not set yet
def targetProject = firstSync ? nodeHelper.getProject("DEMO") : issue.project

// lookup the version in the project and *add* it to the affectedVersions 
issue.affectedVersions += nodeHelper.getVersion(targetVersionName,targetProject)

```

Notice the peculiar ‘+=’ in the last line of the code. AffectedVersions is an array and you either convert the single version to an array (and assign) or add it to the existing.

Let me know if this helps

* * *

---

<div class="post-metadata">

**Author:** ![Sujan\_Karanjeet](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/sujan_karanjeet/32/408_2.png) [@Sujan\_Karanjeet](https://community.exalate.com/u/Sujan_Karanjeet)\
**Post date:** [December 2, 2024, 12:17pm UTC](https://community.exalate.com/t/synchronizing-system-field-with-a-cascade-select-value/4087/4 "2024-12-02T12:17:46Z")

</div>

Hi,

Getting back to this agian. We’ve moved to Jira Cloud and I’ve not able to get this working at all. Has anything changed in cloud so that getting the custom field with Cascade fields would fail?

- Sujan
