Standard Controller and Custom Class Name Conflict

By | December 29, 2015

While working for one of our clients, we came across an unusual error. And the error said:Illegal Assignment

–  Real-time, bi-directional, multi-company – Sage ERP Integration with Salesforce

We had the same data type (at least as per us) on both sides of the assignment operator, a standard account record being assigned to a standard account variable. To us, we had not violated any of the assignment rules but were still encountering this strange error message. Our code looked somewhat like the following:CodeClass with same name

Digging deeper, we realized that the Salesforce Org already had a custom class by the name “Account” and this was conflicting with the standard controller of “Account” provided by the platform. This was the cause of our error. Our custom class was confusing the compiler as to which class object to create and which one to refer. We renamed the custom class and the dependencies for the class; and our code started to work fine.

As a matter of fact, the salesforce platform allows you to create the custom class with the same name as any standard controller, but when you try to use the standard controller it cannot differentiate between the two classes and hence throws the error. So to avoid any such issues, we strongly recommend that one should not name the custom controllers with any of the existing standard object API names.

About Us
Greytrix as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce integration with Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data Migration, Integrated App development, Custom App development and Technical Support to business partners and end users.

Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information, please contact us at We will be glad to assist you.

Related Posts