Solved! Go to Solution.
//populate your attributes using name value pairs
var attr = {"Plant":"Mesa Mint", "Field2:"Value2"};
//graphics doesn't require geometry, symbology or an info window, so you can just pass in attributes
var graphic = new esri.Graphic(null,null,attr,null);
//create an empty array
var features= [];
//push in your attributes
features.push(graphic);
//create your featureSet and push in the feature
var featureSet = new esri.tasks.FeatureSet();
featureSet.features = features;
as an alternative, since many tasks actually return a recordset, it might also make sense to seperate the geocoding from the rest of your geoprocessing and pass the result from the first rather than creating the recordset from scratch.
Ann,
[INDENT]make sure to use version 3.1 of the JS API as the issue mentioned below was fixed at 3.1 and might cause some problems for your particular workflow:[/INDENT]
NIM083266: esri.tasks.FeatureSet.toJson() should ignore the featureSet's fields property when it is an empty array.
John
function findAddress(){
gp = new esri.tasks.Geoprocessor("http://psc-gis-1/AGServer/rest/services/Tools/GeocodeAddress/GPServer/Geocode%20Address");
gp.setOutSpatialReference({wkid:4326});
var attr={"STANDARD":dijit.byId("address"), "ZIPCODE":dijit.byId("zipcode")};
var graphic = new esri.Graphic(null,null,attr,null);
var features=[];
features.push(graphic);
var featureSet=new esri.tasks.FeatureSet();
featureSet.features=features;
var params= {"Input_Table":featureSet}
esri.show(progress);
gp.submitJob(params, completeCallback , statusCallback,function(error){
alert(error);
esri.hide(progress);
});
}i took a look at the information you posted about the GP service above and perhaps you need to be passing an ObjectID as well? if you hit a wall, i highly recommend testing directly in REST until you can figure out exactly what JSON is expected/required to run the service. its a lot easier to reverse engineer in your Javascript application than it is to discover what REST is looking for.
the link below is related to a geocoding task rather than geoprocessing task, but it gives an example of the json for a recordset which has no geometry.
http://resources.arcgis.com/en/help/rest/apiref/geocodeaddresses.html