I am trying to create a future method and pass in the following parameter:

private static void myMethod(Map<Id, List<String>> userMap) {

I get unsupported parameter type.

I can do:

private static void myMethod(Map<Id, String> userMap) {

I know I can't pass objects, but why is a Map with a list of strings no longer accepted?

Is there a way I can do this using JSON serialize/deserialize?


  • You could serialize the map with a list, to a sting, pass the string to the future, then deserialize yes.
    – Eric
    Sep 18, 2015 at 21:11
  • would it just be as simple as: String JSONString = JSON.serialize(MyMapWithStringList);
    – Dman100
    Sep 18, 2015 at 21:28
  • Possibly, yes. All depends on your requirements
    – Eric
    Sep 18, 2015 at 21:30

1 Answer 1


Future method parameters are limited to primitives and collections of primitives. You're attempting to pass in a collection of collections, which is not supported.

You're correct that you can use JSON to get around this. This should put you on the right track:

// populate this however you were previously
Map<Id, List<String>> userMap = new Map<Id, List<String>>();

// serialize your data before calling the future method

private static void myMethod(String userMapSerialized) {
    // deserialize back into our map of lists
    Map<Id, List<String>> userMap = (Map<Id, List<String>>)JSON.deserialize(userMapSerialized, Map<Id, List<String>>.class);

    // and away we go...


A more detailed example can be found here: Passing Objects to Future Annotated Methods.

Also, please take a look at this question regarding the potential implications of using this technique.

  • 1
    This saved me so much heartburn. Genius.
    – booky99
    Mar 10, 2021 at 16:51

You must log in to answer this question.

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