You need to sign in to do that
Don't have an account?
Avoid to get history object(ex: abc__c_hd) when getting custom object list.
Hi ,
I am getting all custom object list from the orgainization, but I am getting historical data objects. I don't want those objects in my list.
Can you please help any one.
List<Schema.SObjectType> allObjectsList = Schema.getGlobalDescribe().values();
Set<String> customObjectsList = new Set<String>();
for(Schema.SObjectType objType : listOfAllObjects)
{
Schema.DescribeSObjectResult objectResult = objType.getDescribe();
if(objectResult.isCustom() && !objectResult.isCustomSetting())
{
customObjectsList.add(objectResult.getName());
}
}
In customObjectsList I am getting 'Historical Data' Objects like abc__c_hd. I don't want '_hd' objects.
Thanks
Venkat
I am getting all custom object list from the orgainization, but I am getting historical data objects. I don't want those objects in my list.
Can you please help any one.
List<Schema.SObjectType> allObjectsList = Schema.getGlobalDescribe().values();
Set<String> customObjectsList = new Set<String>();
for(Schema.SObjectType objType : listOfAllObjects)
{
Schema.DescribeSObjectResult objectResult = objType.getDescribe();
if(objectResult.isCustom() && !objectResult.isCustomSetting())
{
customObjectsList.add(objectResult.getName());
}
}
In customObjectsList I am getting 'Historical Data' Objects like abc__c_hd. I don't want '_hd' objects.
Thanks
Venkat
those objects do exist behind the scenes, but you cannot see them in Create/Objects path (if you are using eclipse to develop, you will be able to see them in the salesforce.schema of your org).
Anyways, if the issue is that you are getting __History objects, you can use the endsWith method and do something like the following:
All Answers
Regards,
Kiran Machhewar
Best regards,
Gonzalo.
Hi Gonzalo, Yes we can use that, but How we can avoid Historical Data objects using standard methods, I am not able to see those objects directly in salesforce(Create->objects path). In background I am getting these objects.
Thanks
Venkata
those objects do exist behind the scenes, but you cannot see them in Create/Objects path (if you are using eclipse to develop, you will be able to see them in the salesforce.schema of your org).
Anyways, if the issue is that you are getting __History objects, you can use the endsWith method and do something like the following: