AnsweredAssumed Answered

Executing a feature action in a widget: what get passed?

Question asked by Stahly on Mar 1, 2017
Latest reply on Mar 2, 2017 by rscheitlin

I have a handful of general questions about what happens when a feature action is executed.

I am attempting to do a query returning all features from Layer2 intersecting a selected feature from Layer1.

The feature action gets called from a popup that comes up after selecting a feature from Layer1.

 

Whenever I attempt to get specific values from the featureSet or featureLayer object I get undefined results, which makes me feel that the widget doesn't get the actual selected feature as an input.

Additionally when I refer to Layer2 via a QuaryTask or a FeatureLayer, I am unable to display any information about Layer2. 

Below is a code snippet. How am I using featureLayer and quarytask constructors wrong?

 

onExecute: function(featureSet, featureLayer){
WidgetManager.getInstance().triggerWidgetOpen(this.widgetId)
.then(function(myWidget) {
//Widget Action
var fName = []; //useless temp array
fName[0] = featureSet.spatialReference.wkid;
fName[1] = featureSet.displayFieldName;
console.log('log: step 0 '+featureLayer.name);

SecDiv_FL = new FeatureLayer("http://services6.arcgis.com/3aTanasiPG0rbYg4/arcgis/rest/services/PLSS_Sanders_2ndDiv/FeatureServer/0");
slct = featureLayer.getSelectedFeatures();
//var queryTask = new QueryTask("http://services6.arcgis.com/3aTanasiPG0rbYg4/arcgis/rest/services/PLSS_Sanders_2ndDiv/FeatureServer/0");

console.log('log: step 0.1 '+featureSet.features[0].attributes['FID']);
Q = new Query();
Q.returnGeometry = true;
Q.outSpatialReference = new SpatialReference({wkid:102100});
Q.geometry = featureSet.features[0].geometry;
Q.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;

Outcomes