2

I'm trying to display Contact MailingAddress field on a component. On the soql in the controller I'm querying for :

List<Contact> contacts = [SELECT Id, Name,MailingAddress  FROM Contact];

this results in an error in the request, checking on the javascript console there is :

"MailingAddress":*/{"message":"An internal server error has occurred\nError ID: 72942496-123091 (1722168560)"}/*ERROR*/

If I query for all fields in the compound Address it works fine.

this is the apex execution output :

38.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
07:15:22.0 (306737)|USER_INFO|[EXTERNAL]|00541000001O7Im|andrea@lg-comp-dev.org|Pacific Standard Time|GMT-08:00
07:15:22.0 (326481)|EXECUTION_STARTED
07:15:22.0 (332688)|CODE_UNIT_STARTED|[EXTERNAL]|01p4100000BhZV9|Contact_LTNG_Ctr.getContactsAndAddress
07:15:22.0 (607772)|HEAP_ALLOCATE|[72]|Bytes:3
07:15:22.0 (648655)|HEAP_ALLOCATE|[77]|Bytes:152
07:15:22.0 (665177)|HEAP_ALLOCATE|[342]|Bytes:408
07:15:22.0 (679285)|HEAP_ALLOCATE|[355]|Bytes:408
07:15:22.0 (692588)|HEAP_ALLOCATE|[467]|Bytes:48
07:15:22.0 (718311)|HEAP_ALLOCATE|[139]|Bytes:6
07:15:22.0 (731282)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:7
07:15:22.0 (741294)|METHOD_ENTRY|[1]|01p4100000BhZV9|Contact_LTNG_Ctr.Contact_LTNG_Ctr()
07:15:22.0 (744925)|STATEMENT_EXECUTE|[1]
07:15:22.0 (751043)|STATEMENT_EXECUTE|[1]
07:15:22.0 (782460)|HEAP_ALLOCATE|[50]|Bytes:5
07:15:22.0 (804790)|HEAP_ALLOCATE|[56]|Bytes:5
07:15:22.0 (810112)|HEAP_ALLOCATE|[64]|Bytes:7
07:15:22.0 (824755)|SYSTEM_MODE_ENTER|false
07:15:22.0 (837155)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
07:15:22.0 (845427)|SYSTEM_MODE_EXIT|false
07:15:22.0 (852434)|METHOD_EXIT|[1]|Contact_LTNG_Ctr
07:15:22.0 (857567)|SYSTEM_MODE_ENTER|false
07:15:22.0 (865680)|HEAP_ALLOCATE|[13]|Bytes:5
07:15:22.0 (868191)|STATEMENT_EXECUTE|[11]
07:15:22.0 (869519)|STATEMENT_EXECUTE|[12]
07:15:22.0 (871750)|HEAP_ALLOCATE|[13]|Bytes:44
07:15:22.0 (880947)|HEAP_ALLOCATE|[13]|Bytes:4
07:15:22.0 (1802623)|SOQL_EXECUTE_BEGIN|[13]|Aggregations:0|SELECT Id, Name, MailingAddress FROM Contact
07:15:22.0 (4093643)|SOQL_EXECUTE_END|[13]|Rows:21
07:15:22.0 (4108546)|HEAP_ALLOCATE|[13]|Bytes:88
07:15:22.0 (4157651)|HEAP_ALLOCATE|[13]|Bytes:1456
07:15:22.0 (4187675)|HEAP_ALLOCATE|[13]|Bytes:88
07:15:22.0 (4197036)|VARIABLE_SCOPE_BEGIN|[12]|contacts|List<Contact>|true|false
07:15:22.0 (4230536)|VARIABLE_ASSIGNMENT|[12]|contacts|{"s":1,"v":"List of size 21 too large to display"}|0x7f28d514
07:15:22.0 (4233732)|STATEMENT_EXECUTE|[14]
07:15:22.0 (4243359)|SYSTEM_MODE_EXIT|false
07:15:22.4 (4264067)|CUMULATIVE_LIMIT_USAGE
07:15:22.4 (4264067)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 1 out of 100
  Number of query rows: 21 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

07:15:22.4 (4264067)|CUMULATIVE_LIMIT_USAGE_END

07:15:22.0 (4293608)|CODE_UNIT_FINISHED|Contact_LTNG_Ctr.getContactsAndAddress
07:15:22.0 (6154291)|EXECUTION_FINISHED

Does anyone know why the Address type fails within the lightning component ? Or if I should modify any setting on my environment?

thanks

  • Can you check your debug logs to see if there is any SFdC apex errors? – Mohith Shrivastava Dec 5 '16 at 14:16
  • no apex errors that I could recognise. I added the log to the question body above. – andrea Dec 5 '16 at 15:19
  • MailingAddress is a compound field which, I suspect, is not supported in Lightning components. Try querying address details individually: List<Contact> contacts = [SELECT Id, Name,MailingStreet, MailingCity FROM Contact]; – dzh Dec 6 '16 at 2:39
  • hi @dhz, yeap querying for the fields individually the logic works fine. Wonder if there's a roadmap detailing when this type of fields will be supported. – andrea Dec 7 '16 at 12:42
0

Use below query:

List contacts = [SELECT Id, Name,MailingStreet, MailingCity FROM Contact];

If you need complete address means please do concatenation and don't forgot to raise the case on salesforce...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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