In 2.10.x or lower, services that support dynamic layers don't convert to dynamic layers in the HTML5 viewer until a feature or tool that requires that functionality is used. For example, using the layer visualization options to resymbolize a layer in the viewer will convert the service to dynamic layers. In version 2.11+, all map services that support dynamic layers will be converted to such on startup, instead of waiting for user actions to trigger the change.
This may be noticed in the GetMapServiceInfo workflow activity, where the layer URL that it returns changes from something like this before converting to dynamic layers:
to something like this after converting to dynamic layers:
Workflows that use GetMapServiceInfo to obtain a URL from a service that supports dynamic layers should also obtain and use a layer source object with that URL, as a best practice. Workflows that don't accommodate by using a layer source object may still appear to work in 2.10.x and earlier, as long as users don't perform actions in the viewer that cause services to convert to dynamic layers. In 2.11+, regardless of the actions the user performs in the viewer, such workflows will fail.
The solution is to propagate the 'layer source' object, which is available from GetMapServiceInfo, to the QueryTask or other activity that uses the layer url variable.
- Open your workflow in Workflow Designer
- Select your GetMapServiceInfo activity
- From the properties panel on the right, in the Out Arguments section, select the text input for "Source"
- Press F3 to create a new variable of type Esri.ArcGIS.Client.LayerSource, and provide a suitable name. This variable will be populated by GetMapServiceInfo when the activity runs.
For a QueryTask activity
- Select the QueryTask activity
- From the properties panel on the right, in the In Arguments section find the input for "Source"
- Enter the layer source variable from your GetMapServiceInfo activity. The QueryTask will use the value from this variable when it runs.
For a DisplayForm Activity AutoComplete Box
- Expand the RuntimeModifications sequence inside your DisplayForm activity
- Drag an Assign Activity into the RuntimeModifications
- On the left side of the Assign, paste: form.Find(Of AutoCompleteBoxFormItem)("AutoCompleteBox1").QueryLayerSource
- Change "AutoCompleteBox1" in the above expression to the correct form item id if necessary. You can check your AutoComplete's id by pressing the Design Form button.
- On the right side of the Assign, enter the layer source variable from GetMapServiceInfo. Your AutoComplete will use the value from this variable when it runs.
For a Select Features activity, Report Activity or a Set Layer Visibility Activity
The SelectFeatures, Report and Set Layer Visibility activities do not require a URL, so they will not require a layer source object. However if they are being supplied with a Layer Id variable that came from GetMapServiceInfo, they will encounter similar issues to those described above. For dynamic layers, the Layer Id returned from GetMapServiceInfo will be "dynamicLayer" instead an the original layer id value like "18". The SelectFeatures and Report and Set Layer Visibility activities cannot use this "dynamicLayer" value. In a case like this, clear the Layer Id property on the SelectFeatures or Report activity and use the Layer Name property instead.
Article is closed for comments.