+ Start a Discussion
HoltzyHoltzy 

Compile Error: alias is too long, maximum of 25 characters

I created a new custom field that is a replacement of an existing one.  The existing field is referenced in an Apex Class.  When I attempt to update the Apex Class with the new field API name I receive the following error:

 

Error: Compile Error: alias is too long, maximum of 25 characters

 

Has anyone seen this error before?  Any suggestions on how to correct it?

 

Thanks

 

Rahul AgarwalRahul Agarwal

Is new field's name more than 25 chars?

 

If yes, make it smaller and then try.

 

Hope it will work.

 

Cheers!

HoltzyHoltzy

Yes, but this field is integrated with some of our backend administrative systems and I was hoping to avoid chaning the field name.  Is it possible to use an alias that is a shortened version of the true field name?

Groundwire ConsultingGroundwire Consulting

Hi,

 

Check your  field name length..and u can deactivate the apex class after which  you will be able to  change the field name.

 

and if you have any more questions please feel to contact me on support@groundwireconsulting.com

Dhaval PanchalDhaval Panchal
Show your soql query. Some time what happens, we miss "," and next fields is treated as alias.
HoltzyHoltzy

Here is the line in question:

 

AggregateResult[] RelPlanB = [select user_sales__c, sum(Total_Assets__c)Total_assets__c 

 

When I try to replace the existing field reference (Total_Assets__c) with the new field reference (Non_Premier_Trust_Assets__c), I receive the compile error.

Mohit Sharma 37Mohit Sharma 37
Hi Holtzy

Use:

AggregateResult[] RelPlanB = [select user_sales__c, sum(Non_Premier_Trust_Assets__c)choosealiasnamelessthan25char 
eg.
AggregateResult[] RelPlanB = [select user_sales__c, sum(Non_Premier_Trust_Assets__c) Non_Premier_Trust_Assets