You need to sign in to do that
Don't have an account?
Adam Bengtson
Visualforce Remoting Exception: Collection is read-only
I have a dynamic soql query that I am trying to run and then update based on what is being passed in.
I've run test on everything from top to bottom and the query and what is being updated should be exactly what I want, but the problem is I cannot get passed "Visualforce Remoting Exception: Collection is read-only" error. I tried using .clone() which worked for some people I found when searching on this but it did not seem to change anything for me.
Another thing I find interesting is that I have this same functionality in another function I wrote and it works fine.
Thanks!
global static Contact submitContactById_test(Map<String, String> basicInfo, Map<String, Boolean> preferences, String user_id) { String s = 'SELECT '; String f = ' FROM Contact'; String w = ' WHERE Individual_Auto_ID__c=\''+user_id+'\''; Integer i = 0; preferences.remove('unsubscribe'); for(String name: basicInfo.keySet()){ s += name + ', '; } for(String name: preferences.keySet()){ if(i != 0) s += ', '; s += name; i++; } contact = Database.query(s+f+w); for(String name: basicInfo.keySet()){ contact.put(name,basicInfo.get(name)); } for(String name: preferences.keySet()){ contact.put(name,preferences.get(name)); } Database.update(contact); return contact; }
I've run test on everything from top to bottom and the query and what is being updated should be exactly what I want, but the problem is I cannot get passed "Visualforce Remoting Exception: Collection is read-only" error. I tried using .clone() which worked for some people I found when searching on this but it did not seem to change anything for me.
Another thing I find interesting is that I have this same functionality in another function I wrote and it works fine.
Thanks!
Here is a working function in the same class:
this completely works and its basically the same idea but without the maps.