In our org's STAGE environment, I ran the following code anonymously in the dev console, intending to clear data from a pair of custom fields for ~400 QuoteLineItem records.

void clearOStatusAmtPd() {
    List<Schema.QuoteLineItem> qliList = [SELECT id FROM QuoteLineItem WHERE Amount_Paid__c != null or Oracle_Status__c != null];
    for (Schema.QuoteLineItem qli : qliList) {
        qli.Amount_Paid__c = null;
        qli.Oracle_Status__c = null;
    update qliList;


This code ran without error and the following SOQL query confirmed the results, returning 0 records:

SELECT id FROM QuoteLineItem WHERE Oracle_Status__c != null or Amount_Paid__c != null

I can see quote line item records for a given quote with the following query:

SELECT id, Product2Id, LineNumber, Quantity, TotalPrice, Oracle_Status__c, Amount_Paid__c FROM QuoteLineItem WHERE QuoteId = '0Q040000000WVvECAW'

which returns 5 records.

However, when I try to browse to the quote (https://cs23.salesforce.com/0Q040000000WVvECAW), I see this under the quote line items:

"Content cannot be displayed: Illegal assignment from List<QuoteLineItem> to List<QuoteLineItem>"

I have to say that is one of the most useless error messages, ever. Can anyone help me to figure how to restore the related list view? Do I have retouch all the QuoteLineItem records?

Thanks in advance for any help w/ this.

  • Do you have a VF page overriding the view, if so post the code where the error is occurring along with applicable variables? Also it the error in your title correct? It seems odd that from a List to a List is the error, typically it is From a List to sObject – Eric Sep 4 '15 at 16:13

I don't know if you're aware or not, but when you run anonymous code from the developer console, it executes in your org. If it's a production org and you have the proper permissions, it will affect the data in your org. So, when you ran the above code and it executed, it did exactly what you wanted it to do.

I suspect that when you go to the page, it's simply not able to return the results because of your having run the above code, thus the illegal assignment. The null values in the above fields could be the cause of the illegal assignments from list to list when the page is trying to load the record from the controller.

  • Thanks for the comment. Yes, I was aware that running the anonymous code would effect the data in the org, that was my intention. It was not the production org, but the test org. The fields are new to the object, and not (explicitly) referenced by the controller. I set initially as part of dev effort. I wanted to clear the data in them, hence setting them to null. – Albert Bupp Sep 4 '15 at 20:42
  • When you added the fields did you happen to make them required? Also, the fact that the record was originally saved with those fields populated might be causing the problem in that they're now explicitly null and being returned with the record when queried. I'm guessing Amount_Paid__c is a decimal. Perhaps setting it to 0 would be a better choice. If the other is a string or picklist, you might want to set it to '' instead of null. – crmprogdev Sep 4 '15 at 20:56
  • No, neither's required, but the amount field is set to the currency type, and the the other is a string. So, in trying to reset both fields to your recommended values (0 & ''), I now get this error: System.DmlException: Update failed. First exception on row 0 with id 0QL40000000DRQAGA4; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, QuoteOverrideAllowed: execution of BeforeUpdate caused by: line 5, column 19: trigger body is invalid and failed recompilation: Variable does not exist: Id: [] – Albert Bupp Sep 4 '15 at 21:22
  • 1
    That would indicate to me that you have a Before Update trigger that fires on Quote and it's child QLI. I suspect that setting the Amount_Paid__c to 0 requires an override. The string definitely should be set to '' instead of null. It could be just the 0 currency that's causing the problem with the trigger. You might try changing just the string to see if it resolves your issue. If it doesn't, then I suggest you try to see if you can restore/recreate the currency values. – crmprogdev Sep 5 '15 at 1:09
  • Thanks again for your help, crmprogdev. I was able to rectify the problem by disabling a few triggers and deleting the Amount_Paid__c field, and then restoring it. I still do not understand why a trigger would consider the "Id" field to be invalid, but I suppose that my anonymous code left the Amount_Paid__c field in an inconsistent state. Cheers. – Albert Bupp Sep 8 '15 at 14:35

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.