I have a component

<apex:component> <apex:attribute name="ssMap" type="Map"/>       

and I have a page which consumes the component

<apex:page controller="SomeController"> 
    <c:someComponent ssMap="{!ssMap}"/> 

Yet when I try to compile the page, I get an error:

Wrong type for attribute <c:someComponent> ssMap="{!ssMap}";. Expected Map, found Map<Map<String,Field>>; (Line: 1, Column: -1)

From what I understand, I can't define the map types in the attribute. Is there any solution to this?

1 Answer 1


Error is weird as


is not even a valid object as it is missing the first map key.

What you could do is create a class (if the Map<Key,Map<Key, Value>> does not work)

public class myMapParameter{
      Map<Key,Map<Key,Value>> item = New Map<Key,Map<Key,Value>>();

then define your component as

      <apex:attribute name="ssMap" type="myMapParameter"/>

from the type definition:

The Apex data type of the attribute. If using the assignTo attribute to assign the value of this attribute to a controller class variable, the value for type must match the data type of the class variable. Only the following data types are allowed as values for the type attribute:

  • Primitives, such as String, Integer, or Boolean.
  • sObjects, such as Account, My_Custom_Object__c, or the generic sObject type.
  • One-dimensional lists, specified using array-notation, such as String[], or Contact[].
  • Maps, specified using type="map". You don't need to specify the map's specific data type.
  • Custom Apex types (classes).

Since lists are required to be one dimensional, maybe maps follow the same pattern even if not explicitly stated

  • yep, this worked. Made the type the controller and just passed that in. Thanks! Dec 8, 2015 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .