Error occurred while performing DELETE operation on sobject: TopicAssignment with data: [record_id] (MALFORMED_QUERY: Implementation restriction: TopicAssignment only allows security evaluation for non-admin users when either (1) LIMIT is specified and at most 1000 or (2) WHERE is specified and filter on Id or Entity)...

Here is my remote object access definitions:

<apex:remoteObjects > <apex:remoteObjectMOdel name="TopicAssignment" fields="Id,TopicId,EntityType" /> </apex:remoteObjects>

I have written a simple fetch function that utilizes the retrieve() operation:

var topicassignment = new SObjectModel.TopicAssignment();
    var fetchTopicAssignments = function() {
      topicassignment.retrieve({ limit: 10 }, function(err, records, event) {
        if(err) {
        else {
          var ul = document.getElementById("TopicAssignmentList");
          records.forEach(function(record) {
            // Build the text for a topicassignment line item
            var tpaText = record.get("EntityType");

            // Add the line item to the list
            var line = document.createElement("li"); 
            line.id = record.get("Id");
            line.innerHTML = '<input type="checkbox" />' + tpaText;



I also have a save function that calls the del() operation on TopicAssignment object instances.

var save = function() {
      var x = document.getElementById("TopicAssignmentList"), 
          c = x.childNodes;

         for (var i = 0; i < c.length; i++) {
            if (c[i].nodeType === 1) {
            var value = c[i].id;
                if (c[i].firstChild.checked) {
                   topicassignment.del(value, updateCallback);

In my updateCallback function, I am handling errors. I have console logged the error messages (if any), and this is where I receive the above error message.

I don't know how to build the del() call with criteria such as LIMIT or WHERE as the documentation states: "del() accepts two arguments, both optional, and can delete one or many records, depending on the arguments that you provide."

RemoteObjectModel.del([record_ids], callback_function)

Any thoughts are much appreciated!

  • Probably its internal bug, I've tried query on retrieve, but nothing works: {limit}, {where: {EntityType: {eq: 'Account' }}}, {where: {Id: ..., {where: {EntityId: ... Apr 20, 2016 at 16:52
  • I was able to source this documentation from the SOAP API developer guide: developer.salesforce.com/docs/atlas.en-us.api.meta/api/… That indicates the delete call is not supported for this object. Apr 28, 2016 at 22:08

1 Answer 1


You can try AJAX Toolkit instead:

<script src="../../soap/ajax/36.0/connection.js" type="text/javascript"></script>

Refactored li element, now getElementsByName("ids") can be used

records.forEach(function(record) {
    var input = document.createElement("input");
    input.name = "ids";
    input.type = "checkbox";
    input.id = record.get("Id");
    var li = document.createElement("li");
    li.innerHTML = input.outerHTML+record.get("EntityType");

Displays as:

<li><input id="0FT36000000Gx2SGAS" name="ids" type="checkbox">Account</li>

Delete function, bulk added:

var delete = function() { 
    var x = document.getElementsByName("ids");
    var record_ids =[]; //collect list of id
    for (var i=0;i<x.length;i++){
        }   }

    for(var i=0;i<result.length;i++){
            console.log("account deleted with id"+result[i].id);
            console.log("failed to delete account"+result[i]);
        }} };
  • Thank you @IlyaLepesh. Great thinking on the workaround. I had never used the AJAX toolkit before, so thank you for introducing that. Apr 22, 2016 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.