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
GRStevenBrookesGRStevenBrookes 

SF Driving me Nuts!!!!

Hi,

 

I am getting a number of errors, which seemed to have just appeared out of know where:

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AutoCreateSA: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AutoCreateSI: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateQATCaseOnSA: execution of BeforeUpdate
caused by: System.QueryException: List has no rows for assignment to SObject
Trigger.CreateQATCaseOnSA: line 6, column 19: []
Trigger.AutoCreateSI: line 23, column 13: []
Trigger.AutoCreateSA: line 53, column 13: []

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AutoCreateSA: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AutoCreateSI: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateQATCaseOnSA: execution of BeforeUpdate
caused by: System.QueryException: List has no rows for assignment to SObject
Trigger.CreateQATCaseOnSA: line 6, column 19: []
Trigger.AutoCreateSI: line 23, column 13: []
Trigger.AutoCreateSA: line 53, column 13: []

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AutoCreateSI: execution of AfterInsert
caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateQATCaseOnSA: execution of BeforeUpdate
caused by: System.QueryException: List has no rows for assignment to SObject
Trigger.CreateQATCaseOnSA: line 6, column 19: []
Trigger.AutoCreateSI: line 23, column 13: []

 

I cant think for the life of me what has changed here to make this happen.

 

any guidence or advice would REALLY be appreciated.

 

NevurothNevuroth

It'd be helpful if you also gave us some context for your errors. Just listing what error messages you've received tells us nothing about your use cases are, what your problems might be, and what the end result that you want is.

GRStevenBrookesGRStevenBrookes

my apologies - to be frank, i dont know. I am trying to upload the following trigger through IDE:

 

trigger CreateQATCaseOnSA on Service_Agreement__c (before update) {

    if(!StaticClass.flag)
    {
        List<Case> listSAC = new List<Case>();
        Id rtId = [select Id,name from RecordType where name ='Client Management' and SObjectType='Case' limit 1].Id;
        
        for(Service_Agreement__c s : trigger.new)
        if(Trigger.isUpdate)
            {
                if(s.count_of_ready_for_QAT__c >0)             
                
                {
                  listSAC.add(new Case(
                  Service_Agreement__c = s.id,
                  AccountId=s.Related_Account__c,
                  RecordTypeId=rtId,
                  Origin='Automated Process',
                  Case_Type__c='Quality Assessment',
                  Case_Reason__c='New Script QAT',
                  Subject='New Build QAT Request',
                  Assessment_Type__c = 'QAT',
                  Requested_By__c=s.OwnerId,
                  Description='Please QAT script by clicking on the Assessment URL above and answering the questions'     
                  ));
               }
            }
    
        if(listSAC.size() > 0)
        {
            insert listSAC;
        }
        
        StaticClass.flag = true ;
    }
    }

 and it failes with the errors above.

 

sorry to be vauge. I would normally give full explanation, but i have not done anything to make this happen??

SuperfellSuperfell

I'd imagine the error is from your record type query, check that that record type still exists.

Sam27Sam27

Well what I can guess out of it is that you are trying to insert a list of case in the trigger but there is (atleast) one another trigger which works on the insertion of Case (named AutoCreatSI (and most probably AutoCreatSA too).

 

So there is some conflict in these triggers.....you must check what those after insert trigger on case are doing....if you cant find out put the code here for others to be helpful.

 

Thanks