I am using Visualforce remoting to send data to a Remote Action method in my controller. The Remote Action method has a Map<String, Object> args parameter.

In the Remote Action method if I try to obtain a Map from the args map, then I get a "Visualforce Remoting Exception: undefined" error.

In other words, on the javascript side I have added an object to my params object:

params.myMap = {isActive: true, isNew: true};
params.nonMapValue = color: 'blue';

I do not get an error in the remote action until I try and obtain the value of the myMap key from the Map.

It is strange because I can put the map into system.debug and it will print out the whole map fine e.g.

{myMap={isActive=true, isNew=true}, nonMapValue=blue}

but I get an error when I try:


Does anyone know why this is? This is not a casting issue because I am not trying to cast it yet.

Can anyone suggest a good way to be able to send over and use a javascript object to my Remote Action method?


  • Can you post the controller Method that you are using ? Also do specify the requirement that you have
    – Kaw Sumit
    Commented Mar 4, 2015 at 12:38
  • I believe the issue is with the Map. When you are defining a remote Method, you actually are defining a webservice within salesforce and somehow i believe that Maps are not supported as part of your webservice.
    – Kaw Sumit
    Commented Mar 4, 2015 at 13:19
  • Thanks Kaw. Yes. I think that must be the case, but it seems that if you define a class with the correct getters and setters and use that as the argument to the RemoteAction, then it will correctly parse maps.
    – Joe
    Commented Mar 4, 2015 at 14:15

2 Answers 2


I got around this error by making the parameter of my Remote Action method a class which I define. Without changing the javascript in any way, the map is now correctly parsed and can be obtained as shown below.

My Class

public class MyClass {
    private String myNonMapValue;
    private Map<String, Boolean> myMap;

    public void setMyNonMapValue(String nmv) {
        this.nonMapValue = nmv;

    public String getMyNonMapValue() {
        return nonMapValue;

    public void setMyMap(Map<String, Boolean> m) {
        this.myMap = m;

    public Map<String, Boolean> getMyMap() {
        return myMap

My Remote Action Method

public static List<String> doWork(MyClass params) {

    String nonMapValue = params.getMyNonMapValue();
    Map<String, Boolean> myMap = params.getMyMap();
  • Also, you're missing the return in the doWork method Commented Sep 8, 2017 at 14:03

This happens because the <ANY> type is not supported in @RemoteAction method signatures. The JavaScript Remoting client throws an UnsupportedOperationError exception in these cases:

  • Object won't work
  • List<Object> won't work
  • Map<String,Object> won't work unless all the map values are primitives

Using the apex class DTO as the parameter type is excellent. (Worth noting the implicit JSON de/serializer runs in strict mode and any properties not present in the DTO throw "Unknown Field")

You must log in to answer this question.

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