I am using salesforce soap api partner WSDL. For example i have a custom field of lead abc__c which is a lookup field and pointing at suppose Account. Now in my code i get this custom field name and its type is reference now all i want is to get the table name at which it is pointing at in Salesforce. I am new to salesforce so sorry if i said any thing wrong not have too much domain knowledge. So please help me.
You can get this information using Salesforce metadata api. You can follow below steps
Calls describeGlobal() to retrieve a list of all available objects for the organization’s data. The describeGlobal method determines the objects that are available to the logged in user.
Calls describeSObjects() to retrieve metadata (field list and object properties) for a specified object. The describeSObject method illustrates the type of metadata information that can be obtained for each object available to the user. Object metadata information includes permissions, field types and lengths, and available values for picklist fields and types for referenceTo fields.
Iterate over results returned in step 2 and compare with your string variable abc__c.
Calls query(), passing a simple query string ("SELECT FirstName, LastName FROM objectname").
Following tutorial contains different methods which you can take as starting point. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_steps_walk_through_code.htm
Find the Field with the matching
name for "abc__c" field. There will be a referenceTo string property that:
indicates the object types of the referenced objects.
Since your field won't be polymorphic the first string in this array will be the API name of the references sObject Type.