function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Richard Pitfield 10Richard Pitfield 10 

My Trigger below is failing deployment:

trigger QuoteSentTrigger on Task (After insert) {
    List<Quote> QuoteToUpdate = new List<Quote>();

    for(Task t : Trigger.new) {
        if(t.WhatId.getSObjectType() == Quote.sObjectType &&
           t.Subject.startsWith('Email:')) {
                QuoteToUpdate.add(new Quote(Id = t.WhatId, Email_Quote_Sent__c = True));
        }
    }

    update QuoteToUpdate;
}

Most of the Test Failures state that "System.SObjectException: Field Product_Type_quote_sync__c is not editable" all of these fields appear on the opportunity object, i'm failry new to development, the trigger runs in the sandbox fine any help much appreciated.

Regards

Richard                             
RaidanRaidan
Hi Richard,

The error might or might not be caused by your trigger. If you run all tests in production without deploying this code, will you also see the same error?
JeffreyStevensJeffreyStevens
You know - you might have a problem with setting the quote.id without querying the record first.  You might try to SOQL to get the quote records before you update them.
Richard Pitfield 10Richard Pitfield 10
Hey Guys, I've run tests in Production Raidan and as you suggested it would appear the trigger is not the issue. I'm not overly sure how I can fix this now..... beyond my understanding.
RaidanRaidan
You will have to check with the System Admin in your org. Somehow a bad code or an unverified system change might break many test classes. Let me know if you need help.