<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic WAB FeatureLayer constructor throwing TypeError: Circular reference in value argument not supported in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-featurelayer-constructor-throwing-typeerror/m-p/722277#M19020</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I’ve run into an exception trying to create a FeatureLayer with the results of a spatial query.&amp;nbsp; The exception stack trace looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;TypeError: Circular reference in value argument not supported&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at b.toJson&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at _initLayer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at Anonymous function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at _initFeatureLayer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at constructor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at h.around.advice&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at h&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at Anonymous function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at _createResultsFeatureLayer&amp;nbsp; (my function)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’ve found several posts that describe circular reference issues with serializing graphics to JSON.&amp;nbsp; Unfortunately none of them seem to fit my predicament.&amp;nbsp; When I look at the FeatureLayer object, all of the graphics contain a reference for the _graphicsLayer, which includes the same collection of graphics with each graphic containing a reference to the _graphicsLayer, etc.&amp;nbsp; Seems infinitely recursive/circular.&amp;nbsp; "The wheels on the bus go ‘round and ‘round…"&amp;nbsp; I am not sure if this is the issue or not – it could be completely unrelated.&amp;nbsp; In any case, I’m not sure how to break the cycle or resolve the exception.&amp;nbsp; Hopefully someone out there might have an answer, or at least some suggestions for things to try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached zip contains a custom widget “CircularReference” that can be used to reproduce the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To include the widget:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Drop the CircularReference folder from the zip into the widgets folder&lt;/LI&gt;&lt;LI&gt;Add the CircularReference to the app’s config.json file, editing index as appropriate.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"widgetPool"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"widgets"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: [&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"uri"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"widgets/CircularReference/Widget"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"version"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"1.3"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"id"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"widgets/CircularReference/Widget_35"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"CircularReference"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"label"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Circular Reference"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"index"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="background-color: transparent; color: #3d3d3d; background: white; font-size: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.5;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Edit the searchLayers element in the CircularReference/config.json file to reference at least two dynamic map service layers in your map.&amp;nbsp; These could be from more than one map service, or multiple layers in a single map service.&amp;nbsp; The values for each layer should be self-explanatory.&amp;nbsp; Be sure to include the layer index at the end of the url.&amp;nbsp; In my test app I was using a sample Esri map service that has four layers in it.&amp;nbsp; If you want to use the config.json file as-is, be sure your webmap includes this map service.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"searchLayers"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Cities"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Highways"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"States"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Counties"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; ],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After getting everything configured, the workflow to generate the exception is as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Zoom to an area of the map that has features from multiple layers in the CircularReference’s config.json searchLayers collection.&lt;/LI&gt;&lt;LI&gt;Click on the Circular Reference button.&lt;/LI&gt;&lt;LI&gt;Click on the search within map extents button.&lt;/LI&gt;&lt;LI&gt;This should kick off the search.&amp;nbsp; The runSpatialQueries() function loops over the specified layers and kicks off a search on each layer.&lt;/LI&gt;&lt;LI&gt;The search results wind up in the processResults() function that fills out a simple tree control.&lt;/LI&gt;&lt;LI&gt;Clicking on one of the results in the tree fires the selectedResultSet() handler, which calls _createResultsFeatureLayer.&lt;/LI&gt;&lt;LI&gt;The results get loaded into a tab in the AttributeTable.&lt;/LI&gt;&lt;LI&gt;Click on a different result item in the tree.&amp;nbsp; The FeatureLayer with the results from the previously selected item is removed from the map. NOTE:&amp;nbsp; In our full application we only show one set of results on the map and in the attribute table at a time. The same process as above executes for the newly selected results item, and the results are successfully displayed in the AttributeTable.&lt;/LI&gt;&lt;LI&gt;Click on the originally selected results item in the tree and the same process executes again.&lt;/LI&gt;&lt;LI&gt;This time the circular reference exception gets thrown in the _createResultsFeatureLayer() function when calling the FeatureLayer constructor.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback, thoughts, or suggestions would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Sep 2015 03:35:55 GMT</pubDate>
    <dc:creator>GarySinner</dc:creator>
    <dc:date>2015-09-24T03:35:55Z</dc:date>
    <item>
      <title>WAB FeatureLayer constructor throwing TypeError: Circular reference in value argument not supported</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-featurelayer-constructor-throwing-typeerror/m-p/722277#M19020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I’ve run into an exception trying to create a FeatureLayer with the results of a spatial query.&amp;nbsp; The exception stack trace looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;TypeError: Circular reference in value argument not supported&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at b.toJson&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at _initLayer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at Anonymous function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at _initFeatureLayer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at constructor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at h.around.advice&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at h&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at Anonymous function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: green; background: white;"&gt;&amp;nbsp; at _createResultsFeatureLayer&amp;nbsp; (my function)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’ve found several posts that describe circular reference issues with serializing graphics to JSON.&amp;nbsp; Unfortunately none of them seem to fit my predicament.&amp;nbsp; When I look at the FeatureLayer object, all of the graphics contain a reference for the _graphicsLayer, which includes the same collection of graphics with each graphic containing a reference to the _graphicsLayer, etc.&amp;nbsp; Seems infinitely recursive/circular.&amp;nbsp; "The wheels on the bus go ‘round and ‘round…"&amp;nbsp; I am not sure if this is the issue or not – it could be completely unrelated.&amp;nbsp; In any case, I’m not sure how to break the cycle or resolve the exception.&amp;nbsp; Hopefully someone out there might have an answer, or at least some suggestions for things to try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached zip contains a custom widget “CircularReference” that can be used to reproduce the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To include the widget:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Drop the CircularReference folder from the zip into the widgets folder&lt;/LI&gt;&lt;LI&gt;Add the CircularReference to the app’s config.json file, editing index as appropriate.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"widgetPool"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"widgets"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: [&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"uri"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"widgets/CircularReference/Widget"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"version"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"1.3"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"id"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"widgets/CircularReference/Widget_35"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"CircularReference"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"label"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Circular Reference"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"index"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="background-color: transparent; color: #3d3d3d; background: white; font-size: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.5;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Edit the searchLayers element in the CircularReference/config.json file to reference at least two dynamic map service layers in your map.&amp;nbsp; These could be from more than one map service, or multiple layers in a single map service.&amp;nbsp; The values for each layer should be self-explanatory.&amp;nbsp; Be sure to include the layer index at the end of the url.&amp;nbsp; In my test app I was using a sample Esri map service that has four layers in it.&amp;nbsp; If you want to use the config.json file as-is, be sure your webmap includes this map service.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"searchLayers"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Cities"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Highways"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"States"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"mapServiceName"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"USA"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"name"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"Counties"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #2e75b6; background: white;"&gt;"url"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt;: &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: #a31515; background: white;"&gt;"&lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black; background: white;"&gt; ],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After getting everything configured, the workflow to generate the exception is as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Zoom to an area of the map that has features from multiple layers in the CircularReference’s config.json searchLayers collection.&lt;/LI&gt;&lt;LI&gt;Click on the Circular Reference button.&lt;/LI&gt;&lt;LI&gt;Click on the search within map extents button.&lt;/LI&gt;&lt;LI&gt;This should kick off the search.&amp;nbsp; The runSpatialQueries() function loops over the specified layers and kicks off a search on each layer.&lt;/LI&gt;&lt;LI&gt;The search results wind up in the processResults() function that fills out a simple tree control.&lt;/LI&gt;&lt;LI&gt;Clicking on one of the results in the tree fires the selectedResultSet() handler, which calls _createResultsFeatureLayer.&lt;/LI&gt;&lt;LI&gt;The results get loaded into a tab in the AttributeTable.&lt;/LI&gt;&lt;LI&gt;Click on a different result item in the tree.&amp;nbsp; The FeatureLayer with the results from the previously selected item is removed from the map. NOTE:&amp;nbsp; In our full application we only show one set of results on the map and in the attribute table at a time. The same process as above executes for the newly selected results item, and the results are successfully displayed in the AttributeTable.&lt;/LI&gt;&lt;LI&gt;Click on the originally selected results item in the tree and the same process executes again.&lt;/LI&gt;&lt;LI&gt;This time the circular reference exception gets thrown in the _createResultsFeatureLayer() function when calling the FeatureLayer constructor.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback, thoughts, or suggestions would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 03:35:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-featurelayer-constructor-throwing-typeerror/m-p/722277#M19020</guid>
      <dc:creator>GarySinner</dc:creator>
      <dc:date>2015-09-24T03:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: WAB FeatureLayer constructor throwing TypeError: Circular reference in value argument not supported</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-featurelayer-constructor-throwing-typeerror/m-p/722278#M19021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The solution to my issue was to create copies of the features found by the query, and then use the set of copied features when creating the feature layer.&amp;nbsp; One of Kelly Hutchins' posts put me on the right track (thank you Kelly!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following &lt;STRONG&gt;bold&lt;/STRONG&gt; lines in the following code snippet show the changes I made to the _createResultsFeatureLayer function in the code attached to the original post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _createResultsFeatureLayer: function (selectedResultsLayerItem) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //--- Kelly Hutchins forum post with example creating feature layer with layer definition:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //---&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2128" data-containertype="14" data-objectid="99683" data-objecttype="1" href="https://community.esri.com/thread/99683"&gt;https://community.esri.com/thread/99683&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // AVOID CIRCULAR REFERENCE EXCEPTION IN FeatureLayer CONSTRUCTOR BY MAKING&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // COPIES OF THE RESULTS, SPECIFICALLY COPIES OF THE RESULT GRAPHIC OBJECTS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // BASED ON ANOTHER POST FROM KELLY WITH WORKAROUND FOR A CIRCULAR &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // REFERENCE ISSUE WHEN PRINTING:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;/SPAN&gt;&lt;A class="jive-link-message-small" data-containerid="2128" data-containertype="14" data-objectid="70485" data-objecttype="2" href="https://community.esri.com/message/70485#70485"&gt;https://community.esri.com/message/70485#70485&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // THIS APPROACH WORKS.&amp;nbsp; THANK YOU KELLY!&amp;nbsp; &lt;/SPAN&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // use toJson() to create an independent COPY of each result feature/graphic. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ONLY replacing the result's set of features, leaving all other properties of the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // original results object intact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // MAKING *COPIES* OF THE ORIGINAL FEATURES IS THE KEY &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TO AVOIDING THE CIRCULAR REFERENCE EXCEPTION.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var copyFeatures = dojo.map(selectedResultsLayerItem.results.features, function (feature) {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new esri.Graphic(feature.toJson());&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectedResultsLayerItem.results.features = copyFeatures;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureCollection = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerDefinition: selectedResultsLayerItem.layerDefinition,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureSet: selectedResultsLayerItem.results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureLayer = new FeatureLayer(featureCollection,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: FeatureLayer.MODE_ONDEMAND,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id: featureLayerId&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Dec 2015 22:38:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/wab-featurelayer-constructor-throwing-typeerror/m-p/722278#M19021</guid>
      <dc:creator>GarySinner</dc:creator>
      <dc:date>2015-12-07T22:38:47Z</dc:date>
    </item>
  </channel>
</rss>

