You need to sign in to do that
Don't have an account?

describe all fields / find all fields where isUpdatable, isAccessible are true
I want to create an interface for merging two custom object records. In order to do this, I want two columns with the values from each field (one field per row, including any possible custom fields), wherein the user can select the surviving value from one or the other records.
The problem is that I want to only display fields that are accessible (field describe "isAccessible") and that are updatable (field describe "isUpdatable").
I could describe the object and then walk the fields doing a describe on each field, but I would quickly hit the limit on number of describe calls per Apex script (10).
Is there another way?
Don't think the describe limits apply to the field describes, this worked fine for me from a VF page.
public String getFieldList() { String x=''; Map<String, Schema.SObjectField> m = Schema.SObjectType.Account.fields.getMap(); for (Schema.SObjectField f : m.values()) { Schema.DescribeFieldResult d = f.getDescribe(); if (d.isUpdateable()) x += d.getName() + ' ' + d.getLabel() + '<br>'; } return x; }
All Answers
Don't think the describe limits apply to the field describes, this worked fine for me from a VF page.
public String getFieldList() { String x=''; Map<String, Schema.SObjectField> m = Schema.SObjectType.Account.fields.getMap(); for (Schema.SObjectField f : m.values()) { Schema.DescribeFieldResult d = f.getDescribe(); if (d.isUpdateable()) x += d.getName() + ' ' + d.getLabel() + '<br>'; } return x; }