Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have generic code in my org that retrieves all fields that are accessible by user

 public static String returnAllFields(String objectName){


    String fieldsCSV = '';

    for(Schema.SObjectField f: Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap().values()){

                DescribeFieldResult fr = f.getDescribe();

                if(fr.isAccessible())
                  fieldsCSV += fr.getLocalName() + ',';
            }


    fieldsCSV = fieldscsv.removeEnd(',');

    return fieldsCSV;

}

It was working fine till last week (prior to Spring 14). All of a sudden visual workflows (that use the above code via Plugin, running via System mode) started failing.

The error is 19:12:50.913 (85913028000)|EXCEPTION_THROWN|[125]|System.QueryException: No such column 'MailingAddress' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

Not really sure why this is happening or if there is any way I can get around the error?

Suggestions: I was thinking of adding a Set of all the fields that I can exclude (possibly all compound fields). But it seems to be like not viable. Is there any other way I can identify if field is compound or not? (maybe a specific SOAPType? ). I tried searching documentation but didn't really find any.

Any help is appreciated...

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Any classes that reference contact object will get this error unless they’re on API version 30

https://success.salesforce.com/issues_view?id=a1p30000000T3FOAA0.. So the simple solustion for your problem is update the version of your class to 30.

Also note that there can be classes that cannot be updated to API version 30 because they require test methods in separate test classes. for this you will need to move your test methods in test classes.https://developer.salesforce.com/forums?id=906F000000093MCIAY

share|improve this answer
    
Thank you, none of our test classes are within actual class, so i will change/re-compile all actual classes to v30.0 and see if it resolves the issue. –  logontokartik Apr 28 at 12:40
    
@logontokartik I guess upgrading the version to 30.0 should resolve this . –  Mohith Shrivastava Apr 28 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.