Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to get the primary key column of the Particular layer added in the Map. Usually 'FID' be found for a Shapefile Layer Source and OBJECTID found for a SDE source layer.

Is there any way to Identify which one is the primary key columns so that I can access those values.

I need to get this using ArcGIS JS API Version.3.3 and I am using ArcGIS Server 10.

Please help me

share|improve this question
You can use "ObejectID".. I am using ObjectID column to display the attribute information of feature. For details please check ArcGIS Java Script API 3.3 samples –  Sunil Feb 5 '13 at 10:23

2 Answers 2

You could loop through the fields for each layer and find the Object ID data type.

share|improve this answer

You could check it with Python...

import arcpy

layer= r"Put here the path to your data"
dscfc = arcpy.Describe(layer)

if dscfc.hasOID == True:
    print dscfc.OIDFieldName
    print "No Primary Key found."

The OIDFieldName is the PK for the table.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.