You need to sign in to do that
Don't have an account?
SimplySfdc
how to check custom field and object
Hi,
Is there anyway to check if a custom field and custom object is exist in an salesforce.com instance?
Is it possible to use Metadata WSDL for this?
I understand I can use partner wsdl using query and if a field / object is not exist will throw error, but i think this is not elegance.
Please advise and thanks.
Sq
Is there anyway to check if a custom field and custom object is exist in an salesforce.com instance?
Is it possible to use Metadata WSDL for this?
I understand I can use partner wsdl using query and if a field / object is not exist will throw error, but i think this is not elegance.
Please advise and thanks.
Sq
for custom object ---->
Schema.getGlobalDescribe().get(objectName).getDescribe().isCustom(); retrun true if API name of custom object.
for custom fields---->
for(SobjectField fieldApi : Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap().values()){
if(fieldApi.getDescribe().isCustom())
// get true
}
Thanks,
Sarfraz