You need to sign in to do that
Don't have an account?
Jeff Bloomer
Invalid Field Error for Data.com Field on Account
Feeling really dumb today, because I can't figure this out.
Anyway, all I'm trying to do is return the three-digit prefix from the NAICS Code in the Data.com information on an Account. When I do so, I get this error:
Save error: Invalid field NaicsCode for SObject Account /SR Salesforce - STAGE/src/classes line 50 Force.com save problem AccountUtils.cls
I'm not doing anything all that difficult, and I validated that my user profile has the field visible.
public static void addThreeDigitNAICS(List<Account> acctList) { Id naicsId = null; String threeDigit = null; List<NAICS_Code__c> naicsCode = new List<NAICS_Code__c>(); for (Account a: acctList){ threeDigit = a.NaicsCode.left(3); ... ... } }
I have access to view the field in just about everything else. Am I just hosed?
Here's what I ended up doing for a workaround. I created a formula field on Account using the LEFT function to get the three-digit code, which I'm then calling in the class. It seems silly that I had to add a field in Account in order to get this done, but it accomplishes what I need. Inefficient, but it works.
All Answers
Is NaicsCode a custom field? Maybe you have to write NaicsCode__c?
Boy do I wish it was that easy. Because it's a Data.com field, it appears in the list of standard fields for Account, so the field name is NaicsCode. It's really frustrating that I can't share screen shots, because I can even see the field as a suggested choice in Eclipse when I place the dot after my variable.
It says: NaicsCode string - Acccount's field
Here's what I ended up doing for a workaround. I created a formula field on Account using the LEFT function to get the three-digit code, which I'm then calling in the class. It seems silly that I had to add a field in Account in order to get this done, but it accomplishes what I need. Inefficient, but it works.