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

Error while using Address object
Hi,
we have a requirement to display the address in a lightning page. To acheive this , when we query on apex controller we are gettign this error.
CODE:
public class AddressController
{
@AuraEnabled
public static List<Address> getAddData{
List<Address> getAddData = [SELECT Id FROM Address ];
return getAddData;
}
}
ERROR:
1) AuraEnabled methods do not support return type of List<System.Address>
2) Illegal assignment from List<Address> to List<System.Address>
Regards,
Desai
we have a requirement to display the address in a lightning page. To acheive this , when we query on apex controller we are gettign this error.
CODE:
public class AddressController
{
@AuraEnabled
public static List<Address> getAddData{
List<Address> getAddData = [SELECT Id FROM Address ];
return getAddData;
}
}
ERROR:
1) AuraEnabled methods do not support return type of List<System.Address>
2) Illegal assignment from List<Address> to List<System.Address>
Regards,
Desai
Greetings to you!
“Address” in Salesforce can also refer to the Address compound field found on many standard objects. When referencing the Address object in your Apex code, always use Schema.Address instead of Address to prevent confusion with the standard Address compound field. If referencing both the address object and the Address field in the same snippet, you can differentiate between the two by using System.Address for the field and Schema.Address for the object.
Please refer to the below links which might help you further with the above requirement.
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_address.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
“Address” in Salesforce can also refer to the Address compound field found on many standard objects. When referencing the Address object in your Apex code, always use Schema.Address instead of Address to prevent confusion with the standard Address compound field. If referencing both the address object and the Address field in the same snippet, you can differentiate between the two by using System.Address for the field and Schema.Address for the object.
Please refer to the below links which might help you further with the above requirement.
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_address.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Regards,
Desai