How to create GPRecordSet object to pass as an input to geoprocessing task

Discussion created by aroranidh on Jul 20, 2011
Latest reply on Jul 20, 2011 by hzhu
Unable to pass value to GPRecordSet object.
Hi , I have a gp task  which requires input as a GPREcordset object  .

Details for input parameter from rest end point

Parameter: record_set
Data Type: GPRecordSet
Display Name: record_set
Direction: esriGPParameterDirectionInput
Default Value:
OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
Add_line (Type: esriFieldTypeString, Alias: Add_line)
state (Type: esriFieldTypeString, Alias: state)
city (Type: esriFieldTypeString, Alias: city)
zip (Type: esriFieldTypeString, Alias: zip)
zip_4 (Type: esriFieldTypeString, Alias: zip_4)
Parameter Type: esriGPParameterTypeRequired

I need to create this GPRecordset object in javascript to pass it to the GP task
Code snipplet
I tried
feature_set = {
       "features" :
          "attributes" : {"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}
        "attributes" : {"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}
var featureSet = new esri.tasks.FeatureSet(feature_set);
var params = {"record_set":featureSet};
gp.submitJob(params, completeUploadCallback , statusUploadCallback,errorAlert); 

The job is successfully submitted , but as soon as it goes to the arcgis server , it fails . I  m able to run the geoprocessing service thru ArcMap by passing the features interactively but I m not able to properly set the FeatureSet object  in javascript.
How can a  GPRecordSet object be created  for an input to geoprocessing service  and passed through Javascript ?