Is there any way to determine dynamically if a field exists on a Common object?
I am looping through the field Ids from the DictTable object for a particular field against a Common object of the same type. Unfortunately I don't have any way to know if those fields exist on this particular instance of the Common object. So there are times when I get the following error (as an example, but can happen to any table/field combination):
Stack trace: Field 'PrimaryAddressLocation' in table 'DirPartyTable' has not been explicitly selected
I want to do something like this:
Common record = //Some process that populates a common record
DictTable dictTable = new DictTable(tblId); //Where tblId is the Id of the table that populated the Common record
DictField dictField;
FieldId fieldId = dictTable.fieldNext(0);
while(fieldId)
{
if(record.(fieldId) != null)
{
//perform some process
}
fieldId = dictTable.fieldNext(fieldId);
}
But when I try to check if record.(fieldId) exists I am getting the error above. Is there anyway to do this check dynamically like this?