I am trying to create some junction records via callout (in this case, SkillUser
records). Since I am doing so from a trigger, I need to use a @future
annotated method. The Apex Developer Guide
states the following about Future Methods (emphasis mine):
Methods with the future annotation must be static methods, and can only return a void type. The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types. Methods with the future annotation cannot take sObjects or objects as arguments.
It seems to me that Map<Id, Set<Id>>
is a collection of primitive data types. However, the compiler states this parameter type is unsupported, despite the fact some other Map
types are supported. Why is that?
Compiles
@future
public static void doStuff(Map<Id, Id> input) { }
@future
public static void doStuff(Set<Id> input) { }
@future
public static void doStuff(List<Id> input) { }
Compile Fail
@future
public static void doStuff(Map<Id, Set<Id>> input) { }
Unsupported parameter type
Map<Id,Set<Id>>
I know I can use workarounds like JSON serialization, but I would like to understand why this type does not count as a collection of primitive data types.